@increase21/simplenodejs 1.0.12 → 1.0.14

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.
Files changed (2) hide show
  1. package/README.md +18 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -74,11 +74,15 @@ 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
+ #### or
80
+ #### ./controllers/{servicefolder}/auth.js
77
81
 
78
82
  ```ts
79
83
  export default AuthControllers extends SimpleNodeJsController {
80
84
 
81
- async login(id:string) {
85
+ async account(id:string) {
82
86
  return this.RunRequest({
83
87
  post: //....your post method handler,
84
88
  get://...
@@ -89,6 +93,19 @@ export default AuthControllers extends SimpleNodeJsController {
89
93
  }
90
94
  };
91
95
  ```
96
+ Available on POST|GET|PUT|DELETE at http://baseURl/{servicefolder}/auth/account
97
+
98
+ #### Running Single Method
99
+ ```ts
100
+ export default AuthControllers extends SimpleNodeJsController {
101
+
102
+ async login() {
103
+ if(this.method !=="post") return this.res.status(405).json({error:"Method Not Allowed"})
104
+
105
+ return YourHandler(SimpleJsPrivateMethodProps)
106
+ }
107
+ };
108
+ ```
92
109
 
93
110
  ### Controller Object Params
94
111
  Each method defined in a controller file is exposed as an endpoint by SimpleNodeJsController.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@increase21/simplenodejs",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Lightweight Node.js HTTP framework with middleware and plugins",
5
5
  "dev": "dist/index.js",
6
6
  "bugs": "https://github.com/increase21/simplenodejs/issues",