-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type error when using middleware #70
Comments
Getting the same error. not fond of having to use |
Hi @danielsundq @tuzzmaniandevil With a framework like Is is possible to achieve the same with this |
Hey there, i've just published the new v1.0.0 release that fixes this issue |
In general, itty follows a different pattern for middleware/handlers. In express, |
const expressMiddleware = (req, res, next) => {
// do something
next() // continue to the next handler
}
const ittyMiddleware = (req, ...other) => {
// do something, but don't return
} In short, middleware === handler in itty, and either can effectively become middleware by not returning. Likewise, any middleware can intercept the chain (e.g. to return a 401 early) by returning something. |
There is a type error when using ordinary itty-router middleware together with an OpenAPIRoute class instance:
The error reads:
Note that the route and the middleware works as it should. This is just a type issue.
The text was updated successfully, but these errors were encountered: