node.js - how to define the file path in nodejs require('') with "../ " Notations? -


i having trouble in defining paths in nodejs.

i need define path ../../ don't understand how use .. notations.

example:

var core=require('../../app/server/controllers');  

in meanjs 0.3 worked good.

now changed mean 0.4 little different folder structure eating time define path.

could give helping explanation dot notation regarding path defining single .?

aim define path of core/server/controller/core.server.controller.js file in custom directory restaurants.server.controller.js

screenshot: enter image description here

your restaurant.server.controller.js in modules/restaurants/server/controllers directory. ../ means go 1 directory, ../../../ (up 3 directories) put in /modules. can find core.server.controller.js following core/server/controllers directories.

so final require want core is:

var core = require('../../../core/server/controllers/core.server.controller'); 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -