From e9aa61e7fb8c048afe96d000b7ba0cb7261791f1 Mon Sep 17 00:00:00 2001 From: LarsVomMars Date: Thu, 9 Jul 2020 23:58:30 +0200 Subject: Boilerplate, debugger, modules, ... --- src/main.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/main.ts') diff --git a/src/main.ts b/src/main.ts index 29dc789..bcdb632 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,9 +1,11 @@ -import { Application } from "https://deno.land/x/abc@v1/mod.ts"; +import { Application, Context } from "https://deno.land/x/abc@v1/mod.ts"; +import "https://deno.land/x/dotenv/load.ts"; +const port = parseInt(Deno.env.get("PORT") || "8080"); const app = new Application(); -console.log("Started server!"); +app.static("/", "./src/public/"); // Manage static files +app.file("/", "./src/public/index.html"); // Render index on / -app.get("/", (c) => { - return "Hello, world!"; -}).start({ port: 8080 }); +app.start({ port }); +console.log(`Server listening on http://localhost:${port}`); -- cgit v1.2.3