blog.js
const express = require('express');const app = express();const home = require('./homegeyao');
const admin = require('./admingeyao');app.use('/home', home);
app.use('/admin', admin);
app.listen(3000);console.log('服务器启动成功');
admingeyao.js
//管理页面
//展示页面
const express = require('express');const admin = express.Router();admin.get('/', (req, res) => {res.send('欢迎来到博客管理');
});module.exports = admin;
homegeyao.js
//展示页面
const express = require('express');const home = express.Router();home.get('/', (req, res) => {res.send('欢迎来到博客首页');
});module.exports = home;
运行结果