Skip to content

Commit

Permalink
add a deno webserver
Browse files Browse the repository at this point in the history
  • Loading branch information
snendev committed Aug 15, 2024
1 parent 02d0fdb commit 3c31824
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
9 changes: 9 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"imports": {
"jsr:@std/http": "jsr:@std/http"
},
"tasks": {
"build": "trunk build --release",
"serve": "deno run -A webserver.ts"
}
}
56 changes: 56 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions plugins/server/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ impl Plugin for NativeServerTransportPlugin {
runtime.spawn(async move {
let cors = warp::cors()
.allow_method("GET")
.allow_origin("http://localhost:8000")
.allow_origin("http://localhost:8080")
.allow_origin("http://127.0.0.1:8000")
.allow_origin("http://127.0.0.1:8080");
let serve_certs = warp::path::end()
.map(move || cert_hash_b64.clone())
Expand Down
9 changes: 9 additions & 0 deletions webserver.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { serveDir } from "jsr:@std/http/file-server";

Deno.serve((request: Request) => {
return serveDir(request, {
fsRoot: "target/trunk",
urlRoot: "",
showIndex: true,
});
});

0 comments on commit 3c31824

Please sign in to comment.