Hey I was trying to understand node-js routes and found this sentence “var express = require(‘../..’);” I don’t understand the meaning/usage of ‘../..’ here please can someone explain it to me?
Advertisement
Answer
‘../..’ is a relative path to index.js file which is situated two folders behind.
Let’s say hypothetically your folder structure looks like this –
JavaScript
x
6
1
folder1
2
- index.js
3
- folder2
4
- folder3
5
- your-code.js
6
and your-code.js looks like this,
JavaScript
1
2
1
const express = require('../..');
2
will mean to import the JS module from ‘index.js’ file in folder1