express学习4-构建模块化路由_javascript

 

const express = require('express');

const app = express();
//创建路由对象
const home = express.Router();
app.use('/home', home);
home.get('/index', (req, res) => {
res.send('欢迎来到我的页面')
})
app.listen(3000);
console.log('服务器启动成功');

express学习4-构建模块化路由_javascript_02