1.2.0 • Published 4 years ago

elf-routing v1.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Elf Routing

Elf Routing is the routing solution for the Elf- suite. It provides utilities that make routing a TypeORM + Express app a breeze.

Methods


RegisterRoutes(app, resolveController, controllers, generatePermissionsFile)

The RegisterRoutes initializes the configured routes. The parameters are described below:

  • app: The express app
  • resolveController?: If you use Dependency Injection, provide a means to resolve a controller. If this is left undefined, a new instance of every controller is created every time it's needed.
  • controllers?: A path to the controllers folder. Default value is src/controller
  • generatePermissionsFile?: Generate a permissions file from methods that have the checkPermissions flag set to true via the Elf Authentication library. The permissions are written to a elf.permissions.ts file in the root folder.

Decorators


The following decorators are provided

@Controller(name)


Decorating a class with @Controller() makes it a controller. The name parameter specifies the route to be assigned to the controller.

@HttpPost(match)


Decorate a method within a controller class with this decorator to make it respond to POST requests. Use the match variable to specify a match pattern.

@HttpGet(match)


Decorate a method within a controller class with this decorator to make it respond to GET requests. Use the match variable to specify a match pattern.

@HttpPut(match)


Decorate a method within a controller class with this decorator to make it respond to PUT requests. Use the match variable to specify a match pattern.

@HttpPatch(match)


Decorate a method within a controller class with this decorator to make it respond to PATCH requests. Use the match variable to specify a match pattern.

@HttpDelete(match)


Decorate a method within a controller class with this decorator to make it respond to DELETE requests. Use the match variable to specify a match pattern.

1.2.0

4 years ago

1.1.2-beta

4 years ago

1.1.1-beta

5 years ago

1.1.0-beta

5 years ago

1.0.20-alpha

5 years ago

1.0.19-alpha

5 years ago

1.0.18-alpha

5 years ago

1.0.17-alpha

5 years ago

1.0.16-alpha

5 years ago

1.0.15-alpha

5 years ago

1.0.13-alpha

5 years ago

1.0.12-alpha

5 years ago

1.0.11-alpha

5 years ago

1.0.10-alpha

5 years ago

1.0.9-alpha

5 years ago

1.0.8-alpha

5 years ago

1.0.7-alpha

5 years ago

1.0.6-alpha

5 years ago

1.0.5-alpha

5 years ago

1.0.4-alpha

5 years ago

1.0.3-alpha

5 years ago

1.0.2-alpha

5 years ago

1.0.1-alpha

5 years ago

1.0.0-alpha

5 years ago