【发布时间】:2021-05-15 14:20:10
【问题描述】:
我正在为基于打字稿的快递服务器开发样板。我的关键要求之一是让 eslint 与 nodemon 一起运行。在我的 package.json 我有...
"scripts": {
"start": "node dist/index.js",
"dev": "nodemon src/index.ts --exec 'eslint . --ext .ts'",
"build": "tsc -p ."
},
此时我的快递应用程序非常简单......
import express from 'express';
import { PORT } from './config/constants';
const app = express();
app.use(express.json());
app.get('/api-v1', (req, res) => {
const test = 3;
console.log(test);
res.send('Hello World');
});
app.listen(PORT, () => {
console.log(`Server is listening on port ${PORT}`);
});
所以当我运行开发脚本"nodemon src/index.ts --exec 'eslint . --ext .ts'" 时,linting 会运行,但是 express 服务器从未启动...我在控制台中看到了这一点:
[nodemon] clean exit - waiting for changes before restart
关于如何解决此问题的任何想法?
【问题讨论】:
标签: javascript typescript express nodemon