this repo has no description smallweb.run
smallweb
4
fork

Configure Feed

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

update example apps

pomdtr 5ab9bf4d eefc3ddf

+57 -1
+4 -1
examples/.smallweb/config.json
··· 1 1 { 2 - "domain": "smallweb.localhost" 2 + "domain": "smallweb.localhost", 3 + "adminApps": [ 4 + "ls" 5 + ] 3 6 }
+1
examples/cli/main.ts
··· 1 1 export default { 2 + fetch: () => new Response("This app is supposed to be used from the cli: smallweb run cli"), 2 3 run() { 3 4 console.log("Hello, world!"); 4 5 }
+52
examples/ls/main.ts
··· 1 + async function handleRequest() { 2 + const { SMALLWEB_DOMAIN, SMALLWEB_DIR } = Deno.env.toObject() 3 + const entries = await Array.fromAsync(Deno.readDir(SMALLWEB_DIR)) 4 + const html = /* html */` 5 + <style> 6 + body { 7 + font-family: Arial, sans-serif; 8 + margin: 0; 9 + } 10 + table { 11 + width: 100%; 12 + border-collapse: collapse; 13 + } 14 + th, td { 15 + border: 1px solid #ddd; 16 + padding: 8px; 17 + text-align: left; 18 + } 19 + th { 20 + background-color: #f2f2f2; 21 + } 22 + tr:nth-child(even) { 23 + background-color: #f2f2f2; 24 + } 25 + </style> 26 + <table> 27 + <thead> 28 + <tr> 29 + <th>Name</th> 30 + <th>URL</th> 31 + </tr> 32 + </thead> 33 + <tbody> 34 + ${entries.filter(entry => !entry.name.startsWith(".")).map(entry => ` 35 + <tr> 36 + <td>${entry.name}</td> 37 + <td><a href="https://${entry.name}.${SMALLWEB_DOMAIN}">https://${entry.name}.${SMALLWEB_DOMAIN}</a></td> 38 + </tr> 39 + `).join('')} 40 + </tbody> 41 + </table> 42 + ` 43 + return new Response(html, { 44 + headers: { 45 + "content-type": "text/html" 46 + } 47 + }) 48 + } 49 + 50 + export default { 51 + fetch: handleRequest 52 + }