lambder 1.0.80 → 1.0.82
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 +5 -5
- package/package.json +1 -1
package/Readme.md
CHANGED
|
@@ -44,7 +44,7 @@ lambder.addApi("getCompanyPage", async (ctx, res) => {
|
|
|
44
44
|
|
|
45
45
|
// Define a simple route
|
|
46
46
|
lambder.addRoute("/hello-world", (ctx, res) => {
|
|
47
|
-
return res.
|
|
47
|
+
return res.html("Hello World");
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
// Route with parameters
|
|
@@ -52,17 +52,17 @@ lambder.addRoute("/user/:userId", async (ctx, res) => {
|
|
|
52
52
|
const user = await getUser(ctx.pathParams.userId);
|
|
53
53
|
if(!user) return res.status404("Not found");
|
|
54
54
|
|
|
55
|
-
return res.
|
|
55
|
+
return res.html(`Hello ${user.name}`);
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
// Define a regex route
|
|
59
59
|
lambder.addRoute(/\/hello-regex/, (ctx, res) => {
|
|
60
|
-
return res.
|
|
60
|
+
return res.html("Hello Regex");
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
//
|
|
63
|
+
// Function routes allows routing on any context variable.
|
|
64
64
|
lambder.addRoute((ctx)=>ctx.path === '/hello-fn-route', (ctx, res) => {
|
|
65
|
-
return res.
|
|
65
|
+
return res.html("Hello from a function route");
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
|