Skip to content

Latest commit

 

History

History
72 lines (48 loc) · 1.39 KB

README.md

File metadata and controls

72 lines (48 loc) · 1.39 KB

Example HTTP API Server running on Deno.

This is a port for Deno of my addressbook Node.js demo.

Install and Run

  1. Fork and clone this repository.
  2. Set up environment.
$ cp env-example .env
$ source .env
  1. Install/Update dependencies.
$ deno cache --reload src/deps.ts
  1. Start a postgres database.
$ docker run -it -d -p 5432:5432 postgres
  1. Create the tables.
$ deno run --allow-net --allow-env src/migrate.js
  1. Run the application:
$ deno run --allow-net --allow-env src/app.js

Testing

The project ships with some sample tests that take advantage of Deno’s built-in test runner.

Run the unit tests:

$ docker run -it -d -p 5432:5432 postgres
$ deno run --allow-net --allow-env src/migrate.js
$ deno test --allow-net --allow-env src/test/database.test.js

Run the integration tests:

$ docker run -it -d -p 5432:5432 postgres
$ deno run --allow-net --allow-env src/migrate.js
$ deno run --allow-net --allow-env src/app.js &
$ deno test --allow-net --allow-env src/test/app.test.js

Docker

The whole application can be packaged in a Docker image for easier deployment.

$ docker build -t addressbook-deno .

License

Copyright (c) 2020 Rendered Text

Distributed under the MIT License. See the file LICENSE.md.