diff options
| author | Christine Dodrill <me@christine.website> | 2019-06-26 03:05:33 +0000 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2019-06-26 03:05:33 +0000 |
| commit | cb972326be7bdfaafe5b4427c89ead8155e2e61f (patch) | |
| tree | fd263edc0f7da0156aba6113f78152cd2c8c8da6 | |
| parent | bfea637d7698f5d9b1bcf5fbc43fc1f7ae245fa8 (diff) | |
| download | x-cb972326be7bdfaafe5b4427c89ead8155e2e61f.tar.xz x-cb972326be7bdfaafe5b4427c89ead8155e2e61f.zip | |
cmd/h: start on the homepage
| -rw-r--r-- | cmd/h/http.go | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/cmd/h/http.go b/cmd/h/http.go index 696cf78..666fa5a 100644 --- a/cmd/h/http.go +++ b/cmd/h/http.go @@ -13,6 +13,7 @@ var ( ) func doHTTP() error { + http.Handle("/", doTemplate(indexTemplate)) http.HandleFunc("/api/playground", runPlayground) return http.ListenAndServe(":"+*port, nil) @@ -53,3 +54,94 @@ func runPlayground(w http.ResponseWriter, r *http.Request) { Results: er, }) } + +func doTemplate(body string) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/html") + fmt.Fprintln(w, body) + }) +} + +const indexTemplate = `<html> + <head> + <title>The h Programming Language</title> + <link rel="stylesheet" href="https://within.website/static/gruvbox.css"> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + </head> + <body> + <main> + <nav> + <a href="/">The h Programming Language</a> - + <a href="/docs">Docs</a> - + <a href="/play">Playground</a> - + <a href="/faq">FAQ</a> + </nav> + + <h1>The h Programming Language</h1> + + <p>A simple, fast, complete and safe language for developing modern software for the web</p> + + <hr /> + + <h2>Example Program</h2> + + <code> + h + </code> + + <hr /> + + <h2>Fast Compilation</h2> + + <p>h compiles hundreds of characters of source per second. I didn't really test how fast it is, but when I was testing it the speed was fast enough that I didn't care to profile it.</p> + + <hr /> + + <h2>Safety</h2> + + <p>h is completely memory safe with no garbage collector or heap allocations. It does not allow memory leaks to happen, nor do any programs in h have the possibility to allocate memory.</p> + + <ul> + <li>No null</li> + <li>Completely deterministic behavior</li> + <li>No mutable state</li> + <li>No persistence</li> + <li>All functions are pure functions</li> + <li>No sandboxing required</li> + </ul> + + <hr /> + + <h2>Zero* Dependencies</h2> + + <p>h generates <a href="http://webassembly.org">WebAssembly</a>, so every binary produced by the compiler is completely dependency free save a single system call: <code>h.h</code>. This allows for modern, future-proof code that will work on all platforms.</p> + + <hr /> + + <h2>Platform Support</h2> + + <p>h supports the following platforms:</p> + + <ul> + <li>Google Chrome</li> + <li>Electron</li> + <li>Chromium Embedded Framework</li> + <li>Microsoft Edge</li> + <li>Olin</li> + </ul> + + <hr /> + + <h2>Testimonials</h2> + + <p>Not convinced? Take the word of people we probably didn't pay for their opinion.</p> + + <ul> + <li>I don't see the point of this.</li> + <li>This solves all my problems. All of them. Just not in the way I expected it to.</li> + <li>Yes.</li> + <li>Perfect.</li> + </ul> + </main> + </body> +</html>` |
