冬天来了,春天还会远吗|

进阶的哈姆雷特

园龄:7年1个月粉丝:3关注:8

node 服务启动

var fs = require('fs');
var path = require('path');
var express = require('express');
var app = express();
app.use(express.static(path.resolve(__dirname, './dist')));
app.get('*', function (req, res) {
    const html = fs.readFileSync(path.resolve(__dirname, './dist/index.html'), 'utf-8');
    res.send(html);
})
app.listen(3001, () => console.log('Listening on port 3001'));

本文作者:进阶的哈姆雷特

本文链接:https://www.cnblogs.com/lbx6935/p/16416522.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   进阶的哈姆雷特  阅读(373)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起