nanoexpress/pro-slim

use middlewares Error

aizxin opened this issue · 2 comments

use middlewares

import nanoexpress from '@nanoexpress/pro-slim';

function two(req, res, next) {
    req.two = true;
    next();
}
  
const app = nanoexpress();
app.use(two)  

app.get('/', async () => {
    return ({ status: 'ok' });
});

app.listen(3000);

Error:Only Async Functions are allowed to expose route

pro-slim allows only async route and middlewares!

It's mentioned in: https://nanoexpress.js.org -> Installation section -> pro-slim tab

If you need sync variant, try pro and simple versions. They both are supports sync variant