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.
Files changed (2) hide show
  1. package/Readme.md +5 -5
  2. 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.json({ message: "Hello World" });
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.json({ message: `Hello ${user.name}` });
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.json({ message: "Hello Regex" });
60
+ return res.html("Hello Regex");
61
61
  });
62
62
 
63
- // Define a function route
63
+ // Function routes allows routing on any context variable.
64
64
  lambder.addRoute((ctx)=>ctx.path === '/hello-fn-route', (ctx, res) => {
65
- return res.json({ message: "Hello from a function route" });
65
+ return res.html("Hello from a function route");
66
66
  });
67
67
 
68
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambder",
3
- "version": "1.0.80",
3
+ "version": "1.0.82",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",