Skip to content

Apply Express routes using TypeScript Decorators

Notifications You must be signed in to change notification settings

just-nick/route-deco

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

route-deco

Basic decorators to setup express controllers without needing a route config file

Usage

Setup your express app as normal then connect it to route-deco

import * as express from 'express';
import { configure } from 'route-deco';

var app = express();

// ...

configure(app);

Then create your controllers as classes. Name your files to match the pattern *.controller.ts

@Controller()
export class MyController {
    @RouteMapping('get', '/path')
    public controllerMethod(req: Request, res: Response, next: NextFunction) {
        res.send('Hello World');
    }
}

Then just start your app. route-deco provides it's own binary which runs your app through ts-node and imports your controllers.

route-deco app.ts

Better documentation to follow...

About

Apply Express routes using TypeScript Decorators

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published