Search code examples
node.jsexpresswebstorm

How to locate files in webstorm nodejs require


How do I know when to use ../ or ./ or even ..// when trying to find a file on webstorm? For example what is happening here is it starting from the top folder or:

var Schema = require('./.services/.router.js');

Solution

  • ./ means you want to access your current directory

    ../ means you want to access first parent of current directory

    For example: when in /home/my/directory/ the ../ will get you into /home/my/