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

panta-pasen-api

v1.3.0

Published

API server - Redis cache for session

Downloads

7

Readme

pp-api

Monolithic Node Express Rest API

The full list of endpoints can be found on the generate API Doc

The functionality is divided by data entity on routes, controllers and models for example:

Scan routes will handle the scan routes incoming express connections checking the authorization, validating the request parameters get information from the Authorization token if need it then calling the controller.

Scan Controller will handle the business logic and maybe defer to other pp-nm-modules that have encapsulated functionality using Mongoose and Sequelize Models to connect to the database.

The mongoose and sql models to connect to the database pp-nm-database-models to hold here.

This API connect to three different sources of data

PostgreSQL to handle account and transactions related data

MongoDB to handle operational data like code, scans and tokens

Redis to add element to a queue handled by pp-queue

The connection is handled in database config and most off values come from .env files

Getting Started

This is instruction will help you get up running with the project on your local machine

Prerequisites

You should install:

Node 10 to run the application

You can install separately or run docker in current repositories:

Use docker

Docker for run locally.

 docker-compose up -d 

Install manually

MongoDB It is 4.0.12 version

PostgreSQL We are running on 9.6

Redis we are using redis for bull (queue jobs)

Then you should init data: Use this repositories with dump and init scripts:
pp-data.

Before running a .env file needs to be present you can use .env.example as starting point

The authorization mechanism of the app will filter the request per domain, so need to update the roles table with the host where the API is going to be running, something like will do if you run the app on localhost port 4000: it will run automatically in pp-data.

Setup connection for pgAdmin in a docker:

host: host.docker.internal
db: pp_rc_current
user: pp_rc_user
password: bowerPass

For mac in docker use :

If you just want to reach a service on the host from within a docker container on Mac OS X you cannot use localhost or 127.0.0.1 . Instead you have to use

host.docker.internal

Running

To run the application you will need you to clone the repository and install the dependencies with:

make node_modules

Then you can start the app with

make run

for starting the API with a watcher for changes

Tests

The test for the API live on test folder and mostly run per API endpoint being more like integration test connecting to the database and sending request to a test API superserver

The framework are mocha, chai, sinon, nock and you can run them with

make test

Be careful that the test will pick up the .env configuration and interact with the MongoDB database set in there

Documentation

If you want to see the API endpoints documentation locally run

make doc

And then open the docs/index.html page

Some processes are documented here

Code styles

We enforce the code style rules with eslint and the base rules set on @pantapasen/eslint-config

Git Workflow

We follow a simple git workflow with feature and bugfix branches and the JIRA code on branch and commits

For example:

git checkout -b feature/BOW-75-fix-login-bug
git commit -m "BOW-75 Fix the bug on user login."

where 75 - sprint number

Deployment

We use jenkins manual deploy:Jenkins Full instruction you can find here: Link

Migration

Full instruction you can find here: Link

We use insomnia for test our endpoints: https://insomnia.rest/

and use this plugin to sync file for insomnia https://insomnia.rest/plugins/insomnia-plugin-repo-sync-2 and setup folder for sync to dev_tools