In node.js, it seems I run into the same 3 filenames to describe the main entry point to an app:
- When using the
express-generatorpackage, anapp.jsfile is created as the main entry point for the resulting app. - When creating a new
package.jsonfile vianpm init, one is prompted for the main entry point file. The default is given asindex.js. - In some programs I have seen,
server.jsserves as the main entry point as well.
Other times, still, it seems as though there are subtle differences in their usage. For example, this node app directory structure uses index.js and server.js in different contexts:
app
|- modules
| |- moduleA
| | |- controllers
| | | |- controllerA.js
| | | +- controllerB.js
| | |- services
| | | +- someService.js
| | +- index.js <--------------
| +- index.js <-------------------
|- middleware.js
+- index.js <------------------------
config
+- index.js <------------------------
web
|- css
|- js
server.js <----------------------------
What are the differences, if any, between these three names?
require('./config');you require ./config/index.js file so it's basicly main entry file for directory. Otherwise they're just names as pointed out by Okanpm initit seems that the default isindex.js