-
Notifications
You must be signed in to change notification settings - Fork 107
Express Middlewares
Thiago Bustamante edited this page Mar 1, 2019
·
3 revisions
This library is an extension for expressjs. So, it is possible to use it together with other express middlewares.
By default, after executing any service exposed with one of typescript-rest annotation, the library calls the express next
function, that will call any other middleware registered in the express request pipeline.
If you want to disable this behaviour, you must use the @IgnoreNextMiddlewares
decorator.
@Path('test')
class TestService {
@GET
@IgnoreNextMiddlewares
test() {
//...
return new Return.RequestAccepted<void>(req.url + "/" + generatedId);
}
}
To ignore next middlewares for all methods of a given class, it is possible to decorate the class itself.
@Path('test')
@IgnoreNextMiddlewares
class TestService {
@GET
test() {
//...
return new Return.RequestAccepted<void>(req.url + "/" + generatedId);
}
}
If you want to ignore next middlewares for all services, it is possible to configure it directly through Server
class:
Server.ignoreNextMiddlewares(true);
You can use the Context.next to call the next middlewares manually.
- Server
- @Path Decorator
- Http Methods
- Request Parameters
- Types and languages
- @BodyOptions Decorator
- Service Context
- Service Return
- @Security Decorator
- Express Middlewares
- @PreProcessor Decorator
- @PostProcessor Decorator
- Server Errors
- Service Factory and IoC
- Inheritance and Abstract Services
- Swagger Documentation