Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ FROM frolvlad/alpine-glibc
ENV DENO_VERSION=1.6.3

RUN apk add --virtual .download --no-cache curl \
&& curl -fsSL https://github.com/denoland/deno/releases/download/v${DENO_VERSION}/deno-x86_64-unknown-linux-gnu.zip \
--output deno.zip \
&& unzip deno.zip \
&& rm deno.zip \
&& chmod 755 deno \
&& mv deno /bin/deno \
&& apk del .download
&& curl -fsSL https://github.com/denoland/deno/releases/download/v${DENO_VERSION}/deno-x86_64-unknown-linux-gnu.zip \
--output deno.zip \
&& unzip deno.zip \
&& rm deno.zip \
&& chmod 755 deno \
&& mv deno /bin/deno \
&& apk del .download

RUN addgroup -g 1993 -S deno \
&& adduser -u 1993 -S deno -G deno \
&& mkdir /deno-dir/ \
&& chown deno:deno /deno-dir/
&& adduser -u 1993 -S deno -G deno \
&& mkdir /deno-dir/ \
&& chown deno:deno /deno-dir/

ENV DENO_DIR /deno-dir/
ENV DENO_INSTALL_ROOT /usr/local
Expand All @@ -29,4 +29,4 @@ WORKDIR /app

ENV PATH="/usr/local/bin:$PATH"

CMD ["denon", "run", "--allow-env", "--allow-net", "main.ts"]
CMD ["denon", "run", "--allow-env", "--allow-net", "httpServer.ts"]
25 changes: 25 additions & 0 deletions src/httpServer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Application, Router } from "https://deno.land/x/oak/mod.ts";

const router = new Router();

/**
* These are all example routes and not meant to be
* part of a solution. For a final solution the routes
* needs to be changed to the desired needs.
*/
router
.get("/", (context) => {
context.response.body = "Hello world!";
})
.get("/register", (context) => {
context.response.body = "You were registered";
})
.get("/login", (context) => {
context.response.body = "You logged in";
});

const app = new Application();
app.use(router.routes());
app.use(router.allowedMethods());

await app.listen({ port: 8000 });