Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-landers committed Mar 7, 2023
1 parent 23fb9d3 commit d48f268
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
10 changes: 10 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"tasks": {
"start": "deno run -A --watch=src/public/ src/index.ts"
},
"fmt": {
"files": {
"include": ["src/"]
}
}
}
14 changes: 7 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { configure, renderFile } from "https://deno.land/x/[email protected]/mod.ts";

const __dirname = new URL(".", import.meta.url).pathname;

const viewPath = [
`${Deno.cwd()}/public/`,
`${Deno.cwd()}/public/partials`,
`${Deno.cwd()}/public/layouts`,
`${__dirname}/public`,
`${__dirname}/public/partials`,
`${__dirname}/public/layouts`,
];
console.log(viewPath);

configure({ views: viewPath });

const server = Deno.listen({ port: 80 });

console.log("File server running on http://localhost:80/");
const __dirname = new URL(".", import.meta.url).pathname;

for await (const conn of server) {
handleHttp(conn).catch(console.error);
Expand Down Expand Up @@ -45,8 +46,7 @@ async function handleHttp(conn: Deno.Conn) {
}
} catch (e) {
console.error(e);
const notFoundResponse = new Response("404 Not Found", { status: 404 });
await requestEvent.respondWith(notFoundResponse);
response = new Response("404 Not Found", { status: 404 });
return;
}

Expand Down

0 comments on commit d48f268

Please sign in to comment.