Skip to content

Commit

Permalink
feat: add test route
Browse files Browse the repository at this point in the history
  • Loading branch information
bbb169 committed Oct 16, 2023
1 parent 204beea commit 940235a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import cookieParser from 'cookie-parser';
import logger from 'morgan';
import cors from 'cors';
import bodyParser from 'body-parser';
import indexRouter from './routes';

const app = express();

Expand All @@ -27,6 +28,8 @@ app.use(bodyParser.urlencoded({
// 配置静态资源路径
app.use(express.static('public'));

app.use('/index', indexRouter);

// 捕捉404并转发到错误处理器
app.use((___, __, next) => {
next(createError(404));
Expand Down
9 changes: 9 additions & 0 deletions routes/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import express from 'express';
const indexRouter = express.Router();

/* test. */
indexRouter.get('/', (req, res) => {
res.send('respond with a resource');
});

export default indexRouter;

0 comments on commit 940235a

Please sign in to comment.