Hello, I am using Node to make a RESTFUL API. I just found out what npm uses now is package-lock.json and I don't know if this changes the way I work with node at all ... this is my error and my code
var express = require('express')
var app = express()
app.get('/', function (req, res) {
res.send('Hello World')
})
app.listen(3000)
I just added this to the package.json and boom magic.
The error may be due to executing "npm start app", what node does is go to the package.json file in the "scripts" section and execute the key that contains "start", as indicated in the Node documentation:
https://docs.npmjs.com/cli/start
What you are passing after "start" are arguments for the commands you have defined in the "start" section.
I recommend this post (if you want to do it with npm start): https://coderwall.com/p/lwfndg/use-npm-start-to-launch-node-app
In case you only want to run without configuring it directly, it would be:
node app.js
I hope I have helped you with your question