0

for some reason I can't get my require to work, it should just find both models fine but the path for the file just won't work.

  • app
    • models
      • user.js
      • match.js
  • server.js

Seems like a simple fix but cannot seem to do it myself right now. I'm using (var User = require('/app/models/user.js');)

Thanks guys.

nickmcblain
  • 155
  • 1
  • 2
  • 12

1 Answers1

0

Actually you also can write it as,

var User = require('./app/models/user')

without even putting .js at the end, as it is added by default.. Just a tip to know :)

and here ./ means the current directory.

Hope it helps :)

suraj
  • 141
  • 8