Comparing version 1.0.2 to 1.0.3
{ | ||
"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[]; | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
19133
217
0