Example HTTP API Server running on Deno.
This is a port for Deno of my addressbook Node.js demo.
- Fork and clone this repository.
- Set up environment.
$ cp env-example .env
$ source .env
- Install/Update dependencies.
$ deno cache --reload src/deps.ts
- Start a postgres database.
$ docker run -it -d -p 5432:5432 postgres
- Create the tables.
$ deno run --allow-net --allow-env src/migrate.js
- Run the application:
$ deno run --allow-net --allow-env src/app.js
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
The whole application can be packaged in a Docker image for easier deployment.
$ docker build -t addressbook-deno .
Copyright (c) 2020 Rendered Text
Distributed under the MIT License. See the file LICENSE.md.