Tuesday, 18 September 2018

If you're using ExpressJS and TypeScript, add decorators to your routes with OvernightJS!

Define controllers and routes with @Controller, @Get, @Post, @Put, @Delete decorators. Makes your express server setup cleaner and more terse. I know that there are some frameworks out there like ts-express-decorators and NestJS, which can add decorators to express routes, but these are massive frameworks with huge amounts of documentation. OvernightJS is clean, simple and meant to be used the same way you would interact with any normal express instance. You basically have the option of using Controller and Route decorators instead of express.Router objects. It also allows you to pass in our own custom router objects such as express-promise-router.​Here's the npm link.Here's the GitHub link with source code and samples.Here's a link to the medium article.

Submitted September 19, 2018 at 07:09AM by theTypeScripter

No comments:

Post a Comment