You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And voila! No need to run a single command, your website is already available at `https://draw.<your-domain>`! And each time the drawing is modified, it get automatically persited to `~/smallweb/draw/data/drawing.json`.
@@ -43,18 +46,22 @@ Smallweb tries to keep it's api as simple as possible. The only requirement is t
43
46
44
47
exportdefault {
45
48
fetch: (request:Request) => {
46
-
returnnewResponse("Example server!");
49
+
returnnewResponse("Handling request!");
50
+
},
51
+
run: (_args:string[]) => {
52
+
console.log("Running command!");
53
+
},
54
+
email: (_msg:ReadableStream) => {
55
+
console.log("Received email!");
47
56
},
48
-
run: () => {
49
-
console.log("Example cli!");
50
-
}
51
57
}
52
58
```
53
59
54
60
You can invoke:
55
61
56
62
- the `fetch` function by send a request to `https://example.<your-domain>`
57
63
- the `run` function by running `smallweb run example` or `ssh example@<your-domain>`
64
+
- the `email` function by sending an email to `example!<your-domain>`
58
65
59
66
Of course, it is super easy to hook these functions to a web framweork like [hono](https://hono.dev) or a cli framework like [commander](https://www.npmjs.com/package/commander).
0 commit comments