1.npm install -g serve/http-server
进入存放静态资源的文件夹(如dist),执行serve / http-server
2.利用express新建一个app.js
const express = require ('express')
const path = require('path')
const app = express()
app.use(express.static(path.join('dist')))
app.listen(3002,()=>{
// console.log('app listening on port 3000.')
})
网友评论