Giter Club home page Giter Club logo

ministryofjustice.viper-service's Introduction

VIPER Rating Service

A Restful service to provide access to the VIPER Rating for a known ID

CircleCI

Swagger documentation

The details of the API can found in the online documentation.

The swagger specification can be found on the path /api-docs.

Running with NodeJS

Start by ensuring you have the most recent version of NodeJS and NPM installed.

Pre-requisites

To find the current version of NodeJS installed on your system, run the following command in your preferred shell;

$ node -v

If you have the latest versions installed you need to get the dependencies loaded, run the following command in your preferred shell;

$ npm install

Running the tests

If you have all the Pre-requisites then you are ready to run the tests. Call the following from your shell;

$ npm test

Running the server

If you have all the Pre-requisites then you are ready to run the service. Call the following from your shell;

$ npm start

Running the server with raw logs

If you wish to have the output in raw JSON, then you can run the server without piping it through bunyan's formatter. Call the following from your shell;

$ node server.js

Running the CicleCI build locally

This can be done using the circleci CLI command, you'll need to set the SNYK_TOKEN environment variable to make this work.

Database connections

This can be left out in dev mode, and any API routes which use the database will fail.

In production the DB connection config is required. The variable should be set like this:

DB_URI=mssql://username:password@server-host:1433/database-name

Migrations

Migrations are managed using knex.

You can execute them with

npm run migrate

Other knex commands can be run via

npm run knex -- <other args>

Seed data

To reset the database back into a known-data state, you can use the seed scripts

npm run seed

Local database setup

To run the database locally, use the docker image.

docker pull microsoft/mssql-server-linux
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<password>' -p 1433:1433 -d microsoft/mssql-server-linux

After you have a database, you'll need to create the database and application user. On real environments this is handled by the terraform code.

export DB_URI=mssql://sa:<password>@localhost:1433/<database-name>
DB_USER=<database-user> DB_PASSWORD=<database-user-password> npm run setup-mssql

And then run the migrations & seeds as with any other environment.

npm run knex -- migrate:currentVersion
npm run migrate
npm run seed

Local database manual querying

The sql-cli package on npm gives you a commandline client called mssql.

npm install -g sql-cli
mssql -s localhost -u <database-user> -p <database-user-password> -d <database-name>

Performing a data upload

TBC

ministryofjustice.viper-service's People

Contributors

llmikeyj avatar glenjamin avatar mattonfoot avatar retroredge avatar romidane 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.