Code Monkey home page Code Monkey logo

jid-server's Introduction

jid-server

codecov jid-server Maintainability Rating

API server for storing jid codes, to be used by jid-ui.

The jid-server uses an internal SQLite database for storing data in a file.

Installation

Requires a recent version of NodeJS, NPM and Yarn.

Download from GitHub and install dependencies using yarn install.

This will also install the required SQLite database software.

Running jid-server

You start the server by executing yarn run start. By default the server listens in TCP port 4000 and stores data in the SQLite database file jiddata.db. By default CORS will not be enabled. If you run the server on a different port than UI (for local testing) you should set the cors parameter to true (see below).

You can change the database path by setting the process variable database. The port can be set with variable port. Use info=true for additional logging and enable CORS with cors=true:

pi@raspberry:~$ export database="jidserver.db"
pi@raspberry:~$ export port=5000
pi@raspberry:~$ export info=true
pi@raspberry:~$ export cors=true
pi@raspberry:~$ yarn run start

Using database 'jidserver.db'
Enabling Cross-origin resource sharing (CORS) on the server
Server running on port 5000!

Run tests

The test suite can be run by executing yarn run test after installation.

Generate testdata

In order to test jid-ui with the jid-server you can generate some random data in your jid-server by running yarn run test-data.

This will by default generate 3 admins, 5 locations, 100 users and enter 2.500 jid codes in the system for this year.

These defaults can be changed if you for instance would like to have 3 users who entered 7 jids on 2 locations in 2 years:

pi@raspberry:~$ export admins=2
pi@raspberry:~$ export locations=10
pi@raspberry:~$ export years=2
pi@raspberry:~$ export users=3
pi@raspberry:~$ export jids=7
pi@raspberry:~$ yarn run generate-test-data

Generating admins
admin 1: Slartibartfast Astra <[email protected]>
admin 2: Fenchurch Vogon <[email protected]>

Generating locations
Location 1 36a31c02-a2d7-43eb-9c65-b98940950ef9: Year 2022 Owner 1351ea3d-2bdc-4218-bf71-9f0c8332c05b JID 3id17a Kakrafroon Kappa Jota
Location 2 049a2785-1ea1-4da5-955f-2384c53d5823: Year 2022 Owner 1351ea3d-2bdc-4218-bf71-9f0c8332c05b JID 5gb11f Frogstar World B Joti
Location 1 84d47a8f-b708-43db-af7c-44122d2a8787: Year 2021 Owner 1351ea3d-2bdc-4218-bf71-9f0c8332c05b JID 6bo89x Magrathea Jota
Location 2 d036b5b4-f22a-4d86-868c-02cbd0bd53a8: Year 2021 Owner e17d57d7-7cff-4e4d-9b3e-07a6cbcfd600 JID 5no05k Milliways Jota/Joti

Generating users
user 1: Blart Gadz
user 2: Anjie Paranoid
user 3: Oolon Mown

Generating jids
jid 1: 6mx46d 84d47a8f-b708-43db-af7c-44122d2a8787 Blart Gadz
jid 2: 6cw11k d036b5b4-f22a-4d86-868c-02cbd0bd53a8 Oolon Mown
jid 3: 3id97x 36a31c02-a2d7-43eb-9c65-b98940950ef9 Anjie Paranoid
jid 4: 5se59b d036b5b4-f22a-4d86-868c-02cbd0bd53a8 Oolon Mown
jid 5: 5gb27r 84d47a8f-b708-43db-af7c-44122d2a8787 Blart Gadz
jid 6: 6br59c 36a31c02-a2d7-43eb-9c65-b98940950ef9 Anjie Paranoid
jid 7: 5se09e 36a31c02-a2d7-43eb-9c65-b98940950ef9 Anjie Paranoid

Done

jid-server's People

Contributors

dependabot[bot] avatar frankbille avatar michaelkringelhede avatar mkringelhede avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.