Socket
Socket
Sign inDemoInstall

decopress

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decopress - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"name": "decopress",
"version": "1.0.2",
"version": "1.0.3",
"description": "ExpressJS with TypeScript Decorators",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -178,3 +178,3 @@ # _Decopress_

import express from 'express';
import {setRoutes} from 'decopress';
import {setRoutes, RoutesConfigClass} from 'decopress';

@@ -186,3 +186,33 @@ const app = express();

// I'm using ExampleController from top examples
setRoutes(new ExampleController(), app);
setRoutes(<RoutesConfigClass>new ExampleController(), app);
```
### _Types_
#### _Method Type_
**Method** type is the available types you can use in the **Route** type.
```
type Method = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'all';
```
#### _Route Type_
**Route** type is the return type of **method** decorators. it contains a url of type string witch is provided url. it also contains a method witch is the selected rest method for the route and it contains stack witch represents middleware and the filnal method.
```
interface Route {
url: string;
method: Method;
stack: RequestHandler[];
}
```
#### _RouteConfig Type_
**RouteConfig** Type is a type that represents the data of Controller. it contains the provided url in url property. it contains provided route configs in RouteConfigProperty. it contains the route object. it also contains the controller middleware and sub controllers.
```
import {RouterOptions} from 'express';
interface RoutesConfig {
url: string;
routerOptions?: RouterOptions;
routes: {
[key: string]: Route;
};
middleware: RequestHandler[];
subControllers: RoutesConfigClass[];
}
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc