const express = require('express');
const app = express();
app.get('/index', (req, res) => {
throw new Error('程序发生了错误');
/* res.send(); */
})
app.use((err, req, res, next) => {
res.status(500).send(err.message);
})
app.listen(3000);
console.log('服务器启动成功');