api #3

Merged
SethTrowbridge merged 7 commits from api into master 2023-07-29 20:30:03 -04:00
5 changed files with 31 additions and 12 deletions
Showing only changes of commit b118ba02f9 - Show all commits

16
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"request": "launch",
"name": "Debug Serve Mode",
"type": "node",
"runtimeExecutable": "deno",
"runtimeArgs": ["task", "debug"],
"attachSimplePort": 9229
}
]
}

View File

@ -1,5 +1,4 @@
{ {
"deno.enable": true, "deno.enable": true,
"deno.unstable": true, "deno.unstable": true
"deno.config": "./deno.json"
} }

View File

@ -12,6 +12,7 @@
"tasks": "tasks":
{ {
"local": "deno run -A --no-lock ./run-local.tsx --port=1234", "local": "deno run -A --no-lock ./run-local.tsx --port=1234",
"serve": "deno run -A --no-lock ./run-serve.tsx --port=1234" "serve": "deno run -A --no-lock ./run-serve.tsx --port=1234",
"debug": "deno run -A --inspect-wait --no-lock ./run-serve.tsx --port=1234"
} }
} }

View File

@ -33,9 +33,6 @@ Configure({
{ {
// we dont need to add ?reload= because this fetch is by way the file system not the hosted url // we dont need to add ?reload= because this fetch is by way the file system not the hosted url
console.log("collecting exports for", Root+inURL.pathname);
const [local, foreign] = await Collect.FileExports(Root+inURL.pathname); const [local, foreign] = await Collect.FileExports(Root+inURL.pathname);
const code =` const code =`
import {FileListen} from ">able/hmr-listen.tsx"; import {FileListen} from ">able/hmr-listen.tsx";
@ -66,10 +63,6 @@ Configure({
catch(e){ /**/ } catch(e){ /**/ }
} }
} }
else
{
console.log("not collecting", inURL.pathname)
}
} }
}); });

View File

@ -278,7 +278,16 @@ export const Configure =(config:ConfigurationArgs)=>
} }
await ImportMapReload(); await ImportMapReload();
await SWCW.default(); try
{
await SWCW.default();
}
catch(e)
{
console.log("swc init error:", e);
}
const server = Deno.serve({port:parseInt(Deno.env.get("port")||"8000")}, async(req: Request)=> const server = Deno.serve({port:parseInt(Deno.env.get("port")||"8000")}, async(req: Request)=>
{ {
const url:URL = new URL(req.url); const url:URL = new URL(req.url);
@ -363,4 +372,5 @@ const server = Deno.serve({port:parseInt(Deno.env.get("port")||"8000")}, async(r
return new Response(`{"error":"unmatched route", "path":"${url.pathname}"}`, {status:404, headers}); return new Response(`{"error":"unmatched route", "path":"${url.pathname}"}`, {status:404, headers});
}); });