npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

modern-slavery-data-service

v0.0.2

Published

Provides a service layer to talk to a database to store and manage data for the main modern slavery app

Downloads

6

Readme

Modern Slavery Data Service

Provides a service layer to talk to a database to store and manage data for the modern slavery application

The main modern slavery service has the ability to save an application or read a saved application. In order to do this, it needs to use this modern-slavery-data-service.

Saving: The main application will send the data to this service as an end point. This service will connect to a database and store that data and respond back to the main application if successful

Reading: The main application will make a request to this modern-slavery-data-service. This service will then connect to the database, get the data back and send it to the main application if it is successful

Contents

  1. Install & Run

Install & Run

The application can be run on your local machine

Dependencies

You will need to have the following installed:

Node JS ( LTS Dubnium v10.x )

npm ( v6.x )

PostgreSQL ( v11.x )

PostgreSQL setup

An example script for a PostgreSQL database and table can be found here: examples/scripts/postgresql/create-test-database.sql You can use the instructions within the script to create a database with the default configurations found in config.js.

Configuration settings

If you wish to use this service in isolation (Standalone configuration settings), it can be run the using the configurations defined in the root of this service.

Alternatively you can pass configs defined in the main application (Main application configuration settings).

If no configuration is defined then the service will fallback to the default values defined in config.js.

Standalone configuration settings

Setup your .env file in the root of this directory to override the following variables based on the values you have setup on your local database installation.

DATA_SERVICE_MODEL - The database used; by default this is set to 'postgresql' the correlating model can be found in the modules folder '/modern-slavery-data-service/models/data-service-postgres.js'

PG_USER - The user name that will be used to connect to your database 

PG_PASSWORD - The password used to access the database

PG_HOST - The host address where the database can be found

PG_DATABASE - The database name

PG_DATABASE_TABLE - The database table used (We are only using one table currently)

PG_PORT -  Port number to access the database

See .env.example in the root of the project for this template

Main application configuration settings

If this service used in conjunction with the modern slavery application; then you will be able to set up environment variables and pass them to the functions exported by this service.

Add the environment variables defined in .env.example to the .env file in the root of the modern slavery application and they can be passed on to this service.

Running the service in isolation

Ensure your database is service is available and running.

Then to run the service use:

npm run dev

Currently running this command will ONLY insert the testData variable found in /modern-slavery-data-service/test.js into your database.

After the data has been inserted, the application will then try to read back the same data from the database.