Have you tried to use __dirname to get the current, full path, working
directory? Or just use relativep aths to the file from where you do the
instance.
Am Mo. Apr. 21 2014 01:43:25 schrieb Alejandro Paciotti:
> I am structuring my node.js application with express as follows:
>
> myApp
> - app
> ---- config
> ---- models
> -------- users. js
> ---- routes
> -------- routes. js
>
> - node_modules
> package.json
> server.js
>
>
> I create a variable User in the file server.js and work fine.
>
> User = require ('./App/models/users')
>
>
>
> But if I write the same sentence in the file routes.js I get the following
> error message:
>
> Can not find module './App/models/users'
>
>
> How I can reference an object in a js file in a subfolder?
>
>
> Thanks in advance.
>
>
>
> [email protected]
>
> --
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.