api #3
1
.vscode/launch.json
vendored
1
.vscode/launch.json
vendored
@ -8,6 +8,7 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Debug Serve Mode",
|
"name": "Debug Serve Mode",
|
||||||
"type": "node",
|
"type": "node",
|
||||||
|
"cwd": "${workspaceFolder}/example",
|
||||||
"runtimeExecutable": "deno",
|
"runtimeExecutable": "deno",
|
||||||
"runtimeArgs": ["task", "debug"],
|
"runtimeArgs": ["task", "debug"],
|
||||||
"attachSimplePort": 9229
|
"attachSimplePort": 9229
|
||||||
|
4
api
Normal file
4
api
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export default (req:Request):Response|false=>
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
@ -7,12 +7,12 @@
|
|||||||
{
|
{
|
||||||
"react":"https://esm.sh/preact@10.15.1/compat",
|
"react":"https://esm.sh/preact@10.15.1/compat",
|
||||||
"react-original":"https://esm.sh/preact@10.15.1/compat",
|
"react-original":"https://esm.sh/preact@10.15.1/compat",
|
||||||
">able/": "https://gitea.hptrow.me/SethTrowbridge/able-baker/raw/branch/master/"
|
">able/": "http://localhost:4507/"
|
||||||
},
|
},
|
||||||
"tasks":
|
"tasks":
|
||||||
{
|
{
|
||||||
"local": "deno run -A --no-lock ./run-local.tsx --port=1234",
|
"local": "deno run -A --reload=http://localhost --no-lock ./run-local.tsx --port=1234",
|
||||||
"serve": "deno run -A --no-lock ./run-serve.tsx --port=1234",
|
"serve": "deno run -A --reload=http://localhost --no-lock ./run-serve.tsx --port=1234",
|
||||||
"debug": "deno run -A --inspect-wait --no-lock ./run-serve.tsx --port=1234"
|
"debug": "deno run -A --reload=http://localhost --inspect-wait --no-lock ./run-serve.tsx --port=1234"
|
||||||
}
|
}
|
||||||
}
|
}
|
4
example/api.tsx
Normal file
4
example/api.tsx
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export default (inReq:Request)=>
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
@ -3,12 +3,15 @@
|
|||||||
"imports":
|
"imports":
|
||||||
{
|
{
|
||||||
"react": "https://esm.sh/preact@10.15.1/compat",
|
"react": "https://esm.sh/preact@10.15.1/compat",
|
||||||
">able/app.tsx": "./app.tsx",
|
">able/": "http://localhost:4507/",
|
||||||
">able/": "http://localhost:4507/"
|
">able/app": "./app.tsx",
|
||||||
|
">able/api": "./api.tsx"
|
||||||
},
|
},
|
||||||
"tasks":
|
"tasks":
|
||||||
{
|
{
|
||||||
"local": "deno run -A --no-lock --reload=http://localhost:4507/ http://localhost:4507/run-local.tsx",
|
"local": "deno run --config=deno.json -A --no-lock --reload=http://localhost:4507 http://localhost:4507/run-local.tsx",
|
||||||
"serve": "deno run -A --no-lock --reload=http://localhost:4507/ http://localhost:4507/run-serve.tsx"
|
"serve": "deno run --config=deno.json -A --no-lock --reload=http://localhost:4507 http://localhost:4507/run-serve.tsx",
|
||||||
|
"deploy":"deno run -A --no-lock --reload=http://localhost:4507 http://localhost:4507/run-deploy.tsx",
|
||||||
|
"debug": "deno run --config=deno.json -A --inspect-wait --no-lock --reload=http://localhost:4507 http://localhost:4507/run-serve.tsx"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -67,6 +67,7 @@ try
|
|||||||
"run",
|
"run",
|
||||||
"-A",
|
"-A",
|
||||||
"--no-lock",
|
"--no-lock",
|
||||||
|
"--config=deno.json",
|
||||||
"https://deno.land/x/deploy/deployctl.ts",
|
"https://deno.land/x/deploy/deployctl.ts",
|
||||||
"deploy",
|
"deploy",
|
||||||
`--project=${useProject}`,
|
`--project=${useProject}`,
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
import * as MIME from "https://deno.land/std@0.180.0/media_types/mod.ts";
|
import * as MIME from "https://deno.land/std@0.180.0/media_types/mod.ts";
|
||||||
import * as SWCW from "https://esm.sh/@swc/wasm-web@1.3.62";
|
import * as SWCW from "https://esm.sh/@swc/wasm-web@1.3.62";
|
||||||
|
|
||||||
|
import Api from ">able/api";
|
||||||
|
|
||||||
|
|
||||||
export const Root = new URL(`file://${Deno.cwd().replaceAll("\\", "/")}`).toString();
|
export const Root = new URL(`file://${Deno.cwd().replaceAll("\\", "/")}`).toString();
|
||||||
|
|
||||||
Deno.args.forEach(arg=>
|
Deno.args.forEach(arg=>
|
||||||
@ -319,7 +322,6 @@ const server = Deno.serve({port:parseInt(Deno.env.get("port")||"8000")}, async(r
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("proxy will be", proxy);
|
|
||||||
|
|
||||||
// allow for custom handler
|
// allow for custom handler
|
||||||
const custom = await Configuration.Serve(req, url, ext, ImportMap, Configuration);
|
const custom = await Configuration.Serve(req, url, ext, ImportMap, Configuration);
|
||||||
@ -328,6 +330,12 @@ const server = Deno.serve({port:parseInt(Deno.env.get("port")||"8000")}, async(r
|
|||||||
return custom;
|
return custom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const api = Api(req);
|
||||||
|
if(api)
|
||||||
|
{
|
||||||
|
return api;
|
||||||
|
}
|
||||||
|
|
||||||
// transpileable files
|
// transpileable files
|
||||||
if(Transpile.Check(ext))
|
if(Transpile.Check(ext))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user