this repo has no description smallweb.run
smallweb
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

improve readme

pomdtr c080fe2c 0862fac1

+16 -9
+16 -9
README.md
··· 8 8 9 9 Let's say I want to self-host my own drawing app. 10 10 11 - ```bash 12 - # the app subdomain will be draw.<your-domain> 11 + First, I'll create a folder for my app: 12 + 13 + ```ts 13 14 mkdir -p ~/smallweb/draw 15 + ``` 14 16 15 - # Smallweb apps can be contained in a single file 16 - cat <<EOF > ~/smallweb/draw/main.ts 17 + Then, I'll create a `main.ts` file in that folder: 18 + 19 + ```ts 20 + // ~/smallweb/draw/main.ts 17 21 import { Excalidraw } from "jsr:@smallweb/excalidraw@0.9.1"; 18 22 19 23 const excalidraw = new Excalidraw({ ··· 21 25 }); 22 26 23 27 export default excalidraw; 24 - EOF 25 28 ``` 26 29 27 30 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 46 44 47 export default { 45 48 fetch: (request: Request) => { 46 - return new Response("Example server!"); 49 + return new Response("Handling request!"); 47 50 }, 48 - run: () => { 49 - console.log("Example cli!"); 50 - } 51 + run: (_args: string[]) => { 52 + console.log("Running command!"); 53 + }, 54 + email: (_msg: ReadableStream) => { 55 + console.log("Received email!"); 56 + }, 51 57 } 52 58 ``` 53 59 ··· 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). 60 67