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

@boklisten/bl-api

v1.13.8

Published

The backend system for boklisten. This readme only describes development, testing and technical info. For a more deep-dive into what bl-api is, [please read our documentation](https://github.com/holskil/bl-doc/blob/master/bl-api/summary.md)

Downloads

6

Readme

bl-api

The backend system for boklisten. This readme only describes development, testing and technical info. For a more deep-dive into what bl-api is, please read our documentation

Requirements

How to run

  1. Clone this repo to your own computer $ git clone https://github.com/holskil/bl-api
  2. Inside the newly created folder do: $ npm i
  3. After the installation is done you must create a file .env and populate it with the required environment variables.
  4. Ensure that mongodb is running and that you have set MONGODB_URI environment variable to the running instance.
  5. In the terminal run $ npm run watch
  6. You will now see a confirmation in the terminal that the application is running
  7. The server is by default running on http://localhost:1337

Populating with data

If this is the first time you have ever set up bl-api on your system then the database is empty. To populate the database with some basic data you can do so manually in the mongo shell or adding it through MongoDB compass. It is also possible to add the data through bl-admin.

Minimum data for a testing environment

Under is a list of data that is needed in the database for a minimal test environment.

  • One user with admin permission
    • Can be done by registering a user in bl-admin and then editing the user object in the database. Change the permission field from customer to admin.
  • One branch object in branches
    • Fully populated with a name and paymentInformation
    • Can be done manually or by uploading a excel file through bl-admin
  • At least one Item in items
    • Can be done manually or by uploading a ecel file through bl-admin
  • At least one BranchItem in branchitems.
    • Is done in bl-admin

Testing

The testing is done with mocha and chai. Test driven development (TDD) is easy when the testing is simple to use and fast.

  • Run all the tests once:
    • npm run test
  • Watch for changes and then test:
    • npm run test:watch
  • Running a specific test-file:
    • ./node-modules/mocha/bin/mocha -r ts-node/register ./src/your/file.spec.ts
    • Since bl-api is written in typescript and mocha in javascript, you must register ts-node

Every typescript source file .ts in src/ has a corresponding .spec.ts file. This is the unit-test file for that .ts file. Example: order.patch.hook.ts has a corresponding order.patch.hook.spec.ts. This file has all the unit-tests for the order patch hook file.

Terminal output

The terminal is the best place to view status when testing bl-api. Under development you can view every action done to the system by viewing the terminal output.

Example of termial output

Different log levels shows different output

  • error
  • warn
  • info
    • This is the level the production server is on, only shows bear minumum information, and error and warn output.
  • verbose
  • debug
  • silly
    • This level is perferred for local development as it shows every log message the system outputs.

Stack

bl-api is a web-server database handler. It is a nodeJS applicatin build on top of express and MongoDB.

  • Express
  • MongoDB
  • NodeJS