Skip to content

Commit 2ac5514

Browse files
authored
Docs/len update readme (#20)
* feat: add controller and request mappers decorators * refactor: remove route array from Http class * refactor: create handler to hook preHandler * feat: implement fastify handler class and set error handler method * style: add more keywords in package.json * feat: add interceptors and terminators middleware to project * feat: add interceptors/terminators middlewares and controller method to router * fix: change ports for each test * feat: add url methods to request and change node ci version * docs: update readme
1 parent 74aa97c commit 2ac5514

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,17 @@ Container.singleton(
194194
// If you use named middlewares in Router, he will register all the three methods of Middleware class.
195195
Route.get('middlewares', 'TestController.index').middleware('middleware')
196196

197-
//
197+
// But you can instantiate the middleware and will register all the three methods
198198
Route
199-
.get('middlewares', 'TestController.index')
200-
.middleware(new Middleware().handle)
199+
// You can use controller method to set the default controller of Router
200+
.controller(new TestController())
201+
.get('middlewares', 'index')
202+
.middleware(new Middleware())
203+
204+
// Or you can set only the method and as second parameter the middleware type
205+
Route
206+
.get('middlewares', new TestController().index)
207+
.middleware(new Middleware().intercept, 'intercept')
201208
```
202209

203210
---

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@secjs/http",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "",
55
"license": "MIT",
66
"author": "João Lenon",

src/Router/Router.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ export class Router {
4747
methods: HttpMethodTypes[],
4848
handler: HandlerContract | string,
4949
): Route {
50-
if (this.controllerInstance && Is.String(handler)) {
50+
if (
51+
this.controllerInstance &&
52+
Is.String(handler) &&
53+
!handler.includes('.')
54+
) {
5155
handler = this.controllerInstance[handler]
5256
}
5357

0 commit comments

Comments
 (0)