uweb/js/deno.js

12 lines
328 B
JavaScript
Raw Permalink Normal View History

2024-03-17 05:23:44 +01:00
import { serveFile } from "https://deno.land/std/http/file_server.ts";
async function handler(req){
let url = req.url;
let iSlash = url.indexOf('/',11);
2024-03-17 06:42:27 +01:00
let path = url.substring(iSlash);
2024-03-17 06:31:45 +01:00
if(path.endsWith('/'))
path = path + 'index.html';
2024-03-17 06:42:27 +01:00
return await serveFile(req, `${Deno.cwd()}`+path);
2024-03-17 05:23:44 +01:00
};
Deno.serve(handler);