1.npm init -y

2.npm i express

NPM I CORS (processing across domains)

npm i nodemon -g

3. Create app.js in the root directory

app.js

const express = require('express')
const cors = require('cors')

const app = express()

app.use(cors())

app.get('/test'.(req, res) = > {
  const arr = [
    { name: 'zs'.age: 14.info: 'basketball' },
    { name: 'ls'.age: 19.info: 'football' },
    { name: 'ww'.age: 17.info: 'badminton' },
  ]
  res.send(arr)
})

app.listen(5000.(err) = > {
  if (err) console.log('Server startup failed', err)
  else console.log('Server started successfully')})Copy the code

Terminal running nodenom.\ app.js appears

The server is started successfully.