Skip to content

Commit

Permalink
Merge pull request #5 from ariesclark/main
Browse files Browse the repository at this point in the history
ensure the next middleware are called in debug logger function 🤦
  • Loading branch information
ridafkih committed Jul 21, 2022
2 parents fc6188d + 212fd03 commit 01df4fe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions lib/src/create-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ export const router = async ({
const app = new Koa();
const router = new Router();

/** A debug logger middleware to log every request to console */
app.use((ctx) => log(`${ctx.method.toLowerCase()} ${ctx.path}`));
app.use((ctx, next) => {
/** A debug logger middleware to log every request to console */
log(`${ctx.method.toLowerCase()} ${ctx.path}`);
return next();
});

middleware.forEach((middlewareFunc) => app.use(middlewareFunc));
app.use(router.routes());
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "18h",
"description": "A Next.js style dynamic API router for Koa-based APIs.",
"version": "3.0.14",
"version": "3.0.15",
"repository": {
"url": "https://github.com/ridafkih/18h"
},
Expand Down

0 comments on commit 01df4fe

Please sign in to comment.