maxserver 0.0.12 → 0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maxserver",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Node server setup based fastify",
5
5
  "author": "Max Matinpalo",
6
6
  "type": "module",
package/templates/env CHANGED
@@ -8,7 +8,7 @@ PORT = 3000
8
8
  # CORS_ORIGIN = https://app.example.com
9
9
 
10
10
  # JWT;
11
- JWT_SECRET = supersecretkey
11
+ # JWT_SECRET = supersecretkey
12
12
 
13
13
  # MongoDB;
14
14
  # MONGODB_URI = mongodb://127.0.0.1:27017/testdb
@@ -1,8 +1,14 @@
1
- // GET /hello
1
+ // POST /hello
2
2
 
3
3
  export default async function handler(req, rep) {
4
4
 
5
- console.log("GET /hello");
5
+ console.log("POST /hello");
6
6
 
7
- return { message: `Hello`, };
8
- }
7
+ return {
8
+ message: `Hello ${req.body.name} 🙋‍♂️`,
9
+ };
10
+ }
11
+
12
+
13
+
14
+ // Try POST with and without name, to see how the schema works
@@ -1,6 +1,10 @@
1
- export const schema = {
1
+ export default {
2
+
3
+ // These 3 fields are for the documentation
4
+ // Not must have, but your auto generated documentation will be great
5
+
2
6
  tags: ["Test"],
3
- summary: "Create greeting",
7
+ summary: "Post hello",
4
8
  description: "Accepts a name and returns a greeting.",
5
9
 
6
10
  body: {
@@ -22,13 +26,11 @@ export const schema = {
22
26
  type: "string",
23
27
  example: "Hello Max",
24
28
  },
25
- user: {
26
- type: "object",
27
- example: {
28
- userId: "64f1c2e9b1a2c3d4e5f67890",
29
- },
30
- },
31
29
  },
32
30
  },
33
31
  },
34
32
  };
33
+
34
+ // Hint - You don't need to write these ourself
35
+ // Just ask chat gpt or gemini to generate them
36
+ // In docs you will find little instruction for it
@@ -0,0 +1,14 @@
1
+ // GET /welcome
2
+
3
+ export default async function handler(req, rep) {
4
+
5
+ console.log("GET /welcome");
6
+ return {
7
+ message: "Weclome to maxserver 😉",
8
+ };
9
+
10
+ }
11
+
12
+
13
+ // Remember the very first line of the file must be the ROUTE COMMENT
14
+ // other imports if needed after it
@@ -1,11 +0,0 @@
1
- // POST /hello
2
-
3
- export default async function handler(req, rep) {
4
-
5
- console.log("POST /hello");
6
-
7
- return {
8
- message: `Hello ${req.body.name}`,
9
- user: req.user || null,
10
- };
11
- }