Thanks to visit codestin.com
Credit goes to github.com

Skip to content

erikvullings/dwang-in-de-zorg

 
 

Repository files navigation

A web application for storing and searching care provider locations, using:

  • A backend service, consisting of:
    • node.js and koa as the backend service.
    • lokijs as an in-memory database, with a JSON file for persistence.
    • rest-easy-loki a REST interface on top of loki, also supporting MongoDB like queries.
  • A frontend single-page application (a so-called SPA), using:
  • A Keycloak identity provider, running in a Docker container. In the .env file, the realm settings and application name need to be provided in order for it to work as expected.

Installation

This application is developed using node.js v10 or later, so please install that first if you don't have it.

To install all project dependencies, start the database service and run parcel to bundle your dependencies. You can access the application at http://localhost:3000.

pnpm i
npm build:domain
npm run serve

Development

As above, but now run parcel in watch mode, and access the application at http://localhost:3000.

npm i
npm start

Building a standalone Docker container

During development, I run the backend server on localhost:3030. This is specified in the packages/app/.env setting via the SERVER="http://localhost:3030" command, as Parcel uses this information and makes it available in the build client. However, during production, the location of the server is based on the location of the application, so if the locations runs at locatieregister.dwangindezorg.nl, then the API is found at locatieregister.dwangindezorg.nl/api. In order to make this work, the .env variable is cleared (commented out).

Please note that the home-page.ts also contains a footer text with a reference to the release date. It would be good to update that too.

So after you have commented out the SERVER variable in the packages/app/.env file, you can now safely run

npm run docker:local    # to build it
npm run docker:run      # to run it locally and test it
### And if you are happy
docker rm lr            # to remove the container you just created
npm run docker:publish  # to publish it to docker to the minvws organisation

Environment settings

  • LOKI_PORT: to change the output port, default 3000, e.g. set LOKI_PORT=80 to serve it at http://localhost.
  • LOKI_DB: to change the database name.
  • LOKI_CORS: to disable CORS.
  • LOKI_PRETTY: to show nicely formatted logs.

Deployment links

To build a Docker container, run npm run docker:local. Test it and publish it npm run docker:publish. Just make sure that you comment the SERVER setting in the .env file in the app package.

Useful links if you have setup a VPN connection with the cloud provider.

API Query examples

If you run these queries in FireFox, you get a nicely formatted JSON output. To see additional commands you can use, go here.

Only get a subset of all properties

To reduce the query size, you can use the view path, e.g. to only return the ID and name, use: /api/zorgaanbieders/view?props=$loki,naam

Query all care providers without locations

Use the query q = {"locaties": { "$size": 0 } }, e.g. /api/zorgaanbieders?q={%22locaties%22:{%22$size%22:0}}

You can combine this with a view filter, e.g. /api/zorgaanbieders/view?props=$loki,naam&q={%22locaties%22:{%22$size%22:0}}

About

A web application for storing and searching locations (in Dutch).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 93.6%
  • CSS 4.2%
  • HTML 1.2%
  • Dockerfile 1.0%