Last active
April 3, 2020 15:34
-
-
Save ahrjarrett/2f4d9aa25a9dd3f4437c6e1ab5d7217e to your computer and use it in GitHub Desktop.
deno uses url protocol to run files. so a gist can double as a TS executable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { listenAndServe } from 'https://deno.land/std/http/server.ts' | |
| const body: string = ` | |
| 🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭 | |
| 🌴🌴🌴 I'M ALLERGIC TO MANGOS 🌴🌴🌴 | |
| 🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭🥭 | |
| ` | |
| const options = { port: 8000 }; | |
| listenAndServe(options, (req) => { | |
| console.log('incoming request') | |
| console.log( | |
| 'hostname', Deno.hostname(), | |
| 'loadavg', Deno.loadavg(), | |
| 'env', Deno.env(), | |
| 'dir<(home)>', Deno.dir('home'), | |
| 'font dir', Deno.dir('font'), | |
| Deno.execPath()) | |
| //console.log(req) | |
| req.respond({ body }); | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment