1 Star 0 Fork 1

Fizz/vue-color

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
localServer.js 859 Bytes
一键复制 编辑 原始数据 按行查看 历史
Liu Xinran 提交于 2017-07-26 17:41 . refactor: debug 'example' script done
const express = require('express')
const path = require('path')
/* eslint-disable new-cap */
const app = new express()
/* eslint-enable new-cap */
const config = require('./config')
const port = process.env.PORT || 3000
app.use(express.static('client'))
/**
* Note: Generally we don't need an application server for serving
* static files; instead we can use a web server such as nginx for static resources.
*/
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*')
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
next()
})
app.get('/static/*', (req, res) => {
res.sendFile(path.join(config.build.assetsRoot, req.path))
})
app.get('*', (req, res) => {
res.sendFile(config.build.index)
})
app.listen(port, () => {
console.log(`local server listening on port ${port}`)
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhouweiguang/vue-color.git
git@gitee.com:zhouweiguang/vue-color.git
zhouweiguang
vue-color
vue-color
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385