mainapp.js
const PORT = 3000
const express = require('express')
const axios = require('axios')
const cheerio = require('cheerio')
const app = express()
app.length(PORT, ()=>console.log('Server running on port ${PORT}'))
package.Json
{
"name": "main-test-api",
"version": "1.0.0",
"description": "",
"main": "mainapp.js",
"scripts": {
"start": "nodemon index.js"
},
"author": "",
"license": "ISC"
}
After running the code this is what i get:
output
[nodemon] app crashed - waiting for file changes before starting..
CodePudding user response:
make change const axios = require('axious') to const axios = require('axios') its a typo error
CodePudding user response:
Replace length => listen
app.listen(PORT, ()=>console.log('Server running on port ${PORT}'))
Package name is wrong
const axios = require('axios')