3
I am creating a file structure in an application where each directory contains an "index" file. This index file takes the name of my directory to improve readability. Ex:
foo
|--foo.js // <- index
|--bin.html
|--bar
| |--bar.js // <- index
|--bin.html
With this, the structure that will be used for a require()
when importing any file will always be something like
const foo = require('./foo/foo');
const bar = require('./foo/bar/bar');
I look for some way to create a file without the nomenclature, and that Nodejs understands for the import, would be something like:
foo
|--.js // <- sem nome = arquivo da pasta
|--bin.html
So I could work with files similar to namespace’s...
Is there any way to do this with Nodejs?
In the case of
|--.js // <- sem nome = arquivo da pasta
how do you want to do therequire
?– Sergio