Sign inSign up

zcnm/backend

By zcnm

•Updated about 6 years ago

Backend application

Image
0

10K+

zcnm/backend repository overview

⁠Guestbook Backend

This application is a JSON based RESTful implementation of a guest book. Its only dependency is a Postgres database. The application will generate it's own required DB schema on startup.

The application listens on port 5000 once its completed booting.

⁠Routes

⁠GET /api/health

A health check endpoint that returns 200 OK when the app is up, healthy and able to connect to the database

⁠GET /api/guests

Returns an array of people that have signed the guest book, e.g.

[
  {
    "id": "a811e354-a522-4dd5-b781-02466cf6f194",
    "firstName": "Hilbert",
    "lastName": "Metz",
    "created": "2020-08-24T02:53:24.133Z"
  },
  {
    "id": "823b20b4-cc95-4188-a82b-978070d34216",
    "firstName": "Myrtie",
    "lastName": "Ankunding",
    "created": "2020-08-24T02:53:29.105Z"
  }
]
⁠POST /api/guests

Creates an entry in the guest book. It expects a body in the following format:

{
  "firstName": "Hilbert",
  "lastName": "Metz"
}

⁠Configuration

The application uses a combination of a config file and environment variable to obtain its config.

⁠Config File

The application loads its configuration from a YAML file on disk that should be mounted to the container.

This configuration file should contain two mandatory fields:

Below is an example:

environment: development
database: postgresql://mydbuser:mysecretpassword@mydbhost/mydbname
⁠Environment Variable
  • BACKEND_CONFIG: The path on disk to the above config file that will be loaded on startup

For example:

BACKEND_CONFIG=/etc/mybackend/config.yml

Tag summary

Content type

Image

Digest

Size

108.1 MB

Last updated

about 6 years ago

docker pull zcnm/backend