mirror of
https://github.com/SrIzan10/starters.git
synced 2026-05-01 11:05:16 +00:00
Deno example (#52)
This commit is contained in:
10
examples/deno/Dockerfile
Normal file
10
examples/deno/Dockerfile
Normal 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
19
examples/deno/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Deno Example
|
||||
|
||||
This example is a small [Deno](https://deno.land/) webserver.
|
||||
|
||||
[](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.
|
||||
10
examples/deno/src/index.ts
Normal file
10
examples/deno/src/index.ts
Normal 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" });
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
[](https://railway.app/new?template=https%3A%2F%2Fgithub.com%2Frailwayapp%2Fexamples%2Ftree%2Fmaster%2Fexamples%2Fexpressjs)
|
||||
|
||||
|
||||
BIN
icons/deno.png
Normal file
BIN
icons/deno.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
Reference in New Issue
Block a user