From 8998c65967783caadf83fcb2f127497db0a9a5d9 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Mon, 22 Feb 2021 21:01:35 +0100 Subject: [PATCH] basic frontend --- README.md | 3 ++- server.ts | 4 +--- view.ts | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 view.ts diff --git a/README.md b/README.md index 08552b0..a806e4f 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,11 @@ Web app which returns the iconic Hello, World in various locales - [x] Select the locale by id - [x] Use with CLI - [x] Basic HTTP server +- [ ] HTML frontend ## Installation -On macOS use HomeBrew to install `deno` then update to latest version. +On macOS use HomeBrew to install `deno` then update to the latest version. ```shell brew install deno diff --git a/server.ts b/server.ts index 0a08e01..26873dd 100644 --- a/server.ts +++ b/server.ts @@ -1,11 +1,9 @@ import { Application, Router, RouterContext } from "./deps.ts"; import { ID, sayHello, sayRandomHello } from "./src/index.ts"; +import { htmlBody } from "./view.ts"; const port = 8000; -const htmlBody = (content: string) => - `
${content}
`; - type AppOpts = { port: number }; const get_application = ({ port }: AppOpts): Application => { const router = new Router(); diff --git a/view.ts b/view.ts new file mode 100644 index 0000000..5a7784a --- /dev/null +++ b/view.ts @@ -0,0 +1,44 @@ +export const htmlBody = (content: string) => + ` + + + + + + + + Hello client + + +

Hello client

+
${content}
+ +`;