@increase21/simplenodejs 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,11 +74,14 @@ app.listen(4000,callback)
|
|
|
74
74
|
## 📁 Controllers
|
|
75
75
|
|
|
76
76
|
Controllers are auto-loaded from `controllersDir`.
|
|
77
|
+
#### Running Multiple Methods
|
|
78
|
+
./controllers/{servicefolder}/auth.ts
|
|
79
|
+
./controllers/{servicefolder}/auth.js
|
|
77
80
|
|
|
78
81
|
```ts
|
|
79
82
|
export default AuthControllers extends SimpleNodeJsController {
|
|
80
83
|
|
|
81
|
-
async
|
|
84
|
+
async account(id:string) {
|
|
82
85
|
return this.RunRequest({
|
|
83
86
|
post: //....your post method handler,
|
|
84
87
|
get://...
|
|
@@ -89,6 +92,19 @@ export default AuthControllers extends SimpleNodeJsController {
|
|
|
89
92
|
}
|
|
90
93
|
};
|
|
91
94
|
```
|
|
95
|
+
Available on POST|GET|PUT|DELETE at http://baseURl/{servicefolder}/auth/account
|
|
96
|
+
|
|
97
|
+
#### Running Single Method
|
|
98
|
+
```ts
|
|
99
|
+
export default AuthControllers extends SimpleNodeJsController {
|
|
100
|
+
|
|
101
|
+
async login() {
|
|
102
|
+
if(this.method !=="post") return this.res.status(405).json({error:"Method Not Allowed"})
|
|
103
|
+
|
|
104
|
+
return YourHandler(SimpleJsPrivateMethodProps)
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
```
|
|
92
108
|
|
|
93
109
|
### Controller Object Params
|
|
94
110
|
Each method defined in a controller file is exposed as an endpoint by SimpleNodeJsController.
|
package/package.json
CHANGED