Skip to content

REST API server for a WiFi-based contact tracing application developed as part of @danilo-delbusso 's final year project

License

Notifications You must be signed in to change notification settings

wifi-tracing/server

Repository files navigation

Release Forks Stargazers Issues MIT License LinkedIn


Logo

Server

Web server for a WiFi based contact tracing application, developed as part of @danilo-delbusso's a final year project
Report Bug

ℹ About The Project

This project contains a NodeJS based REST API to interface with the MongoDB backend provided for the WiFi contact tracing project.

Automatically generated documentation can be accessed at http://localhost:4863/api-docs once the project has started.

🚨 The docs only work if the Server is hosted at localhost:4683. To change this modify swagger.js.

💽 Installation

🐋 Docker

This installation is the fastest, but requires docker and docker-compose.

This installation is also suggested for running on remote servers and cloud service providers.

Once you have installed these dependencies run

docker-compose up --build

The API will be available at http://localhost:4683

💻 Local Installation

To install locally without the use of Docker you will need the following dependencies installed and configured on your system:

It is suggested to install Node.js and npm using nvm.

Install local dependencies

npm install

Run with prettified logs

npm run dev

Or run without prettified logs

npm start

Or run using PM2

pm2 start

⚙ Configuration

This repository contains a pre-packaged configuration in the form of an .env file.

While it is useful to demo and run the application, it is important to CHANGE THE VALUES for security reasons.

This is an overview of the used .env values:

Name Description Default Value
PORT The server's port 4683
DOMAIN The server's domain localhost
API_PREFIX The base URL for the API /api/v1/
DOCKER_ENV true if the Server has to run in a Docker container false
DOCKER_DATABASE_URL The MongoDB URL used when DOCKER_ENV is "true" mongodb://mongo:27017/prj
DATABASE_URL The MongoDB URL used when not DOCKER_ENV isn't "true" mongodb://localhost:27017/prj
DB_NAME The name of the database prj
TOKEN_KEY The key used to generate JWTs THIS_IS_A_SECRET_KEY
TOKEN_EXPIRATION_TIME The time of expiry for JWTs 1m
DEV_UPLOAD_TOKEN A special token that bypasses token validation Jt(I9}SFd~|.}c^ZN?(4y8m?aI0~-b
CACHE_ON_STARTUP Load cached features and heat-map data when first starting false
GEOJSON_URL URL of the GEOJson feature collection used to cache data https://raw.githubusercontent.com/previsedigital/UK-GeoJSON/master/json/electoral/eng/wpc.json

👷 PM2

The Server runs on the PM2 process manager. By default it will use all the cores available to it. To change this option, modify the instances property in the ecosystem.config.js file to the number of cores you want (e.g. instances : 1).

🗺 Roadmap

See the open issues for a list of proposed features (and known issues).

💁 Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create.

The repo itself is just used to show the project. It is NOT actively maintained. The author suggests forking the project instead of opening new issues.

⚖ License

Distributed under the MIT License. See LICENSE for more information.

🐦 Contact

Danilo Del Busso - @danilo_delbusso

🙏 Attributions

Icons made by Freepik from www.flaticon.com