The README document of my node server instructs me to run this command on my command prompt.
node .
What does this command do? How does it start my node server?
My package.json contents are
{ "name": "uber-api", "version": "1.0.0", "description": "Move your app forward with the Uber API", "main": "index.js", "keywords": [ "swagger" ], "license": "MIT", "private": true, "dependencies": { "connect": "^3.2.0", "js-yaml": "^3.3.0", "swagger-tools": "0.9.*" } }
Node. js is primarily used for non-blocking, event-driven servers, due to its single-threaded nature. It's used for traditional web sites and back-end API services, but was designed with real-time, push-based architectures in mind.
By default Node.js is trying to load a module located in the folder that you are passing to it as an argument (.
- just bash variant of the current folder). Then it runs whatever is written in the "main"
section of the package.json
file found in this folder.
In your case, it'll try to run node ./index.js
Doc: https://docs.npmjs.com/files/package.json#main
Good point from @djechlin: if no package.json
found in the folder or if no "main"
section is present, then Node.js will try to run the index.js
file in this particular folder you are passing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With