Skip to content

An example Deno service to run on Google Cloud Run

License

Notifications You must be signed in to change notification settings

humanwhocodes/hello-deno-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hello Deno Service

by Nicholas C. Zakas

If you find this useful, please consider supporting my work with a donation.

Description

A simple Deno server intended to serve as an example of deploying a Deno application to Google Cloud Run.

Usage

After cloning the repository, start the server:

$ deno run --allow-net --allow-env src/index.js

Locally, this will run the server on http://localhost:8080.

To use the Docker container, run:

$ docker build -t app . && docker run -it --init -p 8080:8080 -e PORT=8080 app

Notes

  1. The server reads from the PORT environment variable to determine which port to listen on. This is important because Google Cloud Run defines this variable and it's the only port that will be open.
  2. Google Cloud Run also requires that the server listen on 0.0.0.0 because 127.0.0.1 is a loopback address with no external access.
  3. Deno requires that the port value is a number and will throw an error otherwise.

License

Apache 2.0

About

An example Deno service to run on Google Cloud Run

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published