Deno example (#52)

This commit is contained in:
Jake Runzer
2021-02-04 19:40:30 -07:00
committed by GitHub
parent ee783b580a
commit ff49cd97cc
5 changed files with 40 additions and 2 deletions

10
examples/deno/Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM hayd/alpine-deno:1.7.1
WORKDIR /app
USER deno
# These steps will be re-run upon each file change in your working directory:
ADD . .
CMD deno run --allow-net --allow-env src/index.ts

19
examples/deno/README.md Normal file
View File

@@ -0,0 +1,19 @@
# Deno Example
This example is a small [Deno](https://deno.land/) webserver.
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new?template=https%3A%2F%2Fgithub.com%2Frailwayapp%2Fexamples%2Ftree%2Fmaster%2Fexamples%2Fdeno)
## ✨ Features
- Deno
- TypeScript
## 💁‍♀️ How to use
- [Install Deno](https://deno.land/)
- Run server `deno --allow-net --allow-env src/index.ts`
## 📝 Notes
This is an experimental example and should not be used in production.

View File

@@ -0,0 +1,10 @@
import { serve } from "https://deno.land/std@0.85.0/http/server.ts";
let port = parseInt(Deno.env.get("PORT") ?? "8000")
const s = serve({ port });
console.log(`http://localhost:${port}/`);
for await (const req of s) {
req.respond({ body: "Choo Choo! Welcome to you Deno app\n" });
}

View File

@@ -1,7 +1,6 @@
# ExpressJS Example
This example starts an [ExpressJS](https://expressjs.com/) server that connects
to a Railway PostgreSQL database.
This example starts an [ExpressJS](https://expressjs.com/) server.
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new?template=https%3A%2F%2Fgithub.com%2Frailwayapp%2Fexamples%2Ftree%2Fmaster%2Fexamples%2Fexpressjs)

BIN
icons/deno.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB