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
package/templates/env
CHANGED
package/templates/src/hello.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
//
|
|
1
|
+
// POST /hello
|
|
2
2
|
|
|
3
3
|
export default async function handler(req, rep) {
|
|
4
4
|
|
|
5
|
-
console.log("
|
|
5
|
+
console.log("POST /hello");
|
|
6
6
|
|
|
7
|
-
return {
|
|
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
|
|
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: "
|
|
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
|