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

dffrnt.api

v4.0.4

Published

A project for easy-ish API creation and configuration.

Downloads

71

Readme

dffrnt.api

A project for easy-ish API creation and configuration.

Sourcegraph for Repo Reference Count Sourcegraph for Repo Reference Count Sourcegraph for Repo Reference Count Sourcegraph for Repo Reference Count

DFFRNT Logo

Contents

  1. Prequisites
    1. Structure
  2. Setup
    1. Pre-Configuration
    2. Installing
    3. Post-Configuration
    4. Launching
  3. Modules
    1. dffrnt.utils
    2. dffrnt.model
    3. dffrnt.route
  4. License

Prequisites

  • NodeJS (Latest)
  • NPM (Installed with NodeJS)
  • REDIS (See Structure below)
    • Install this in the same parent folder as this project under REDIS/
  • MySQL (v5.6+)
    • A user@% account is required for later configuration

Structure

Parent_Folder/ (Name NOT important)
   ├── dffrnt.api/ (Project-Root; any no-spaced Name will do)
   │   ├── config/ (Reference only; no need to create these!)
   │   └── ...
   └── REDIS/ (Name important! Don't change this name!!)

In this document, ./, refers to the project root; while, ../, refers to the parent folder


Setup

Pre-Configuration

  1. Ensure the folder structure is setup.

  2. Ensure the prequisites are installed.

    • If the install method you chose for REDIS installs the files in a default location, be sure to symlink that location to the ../REDIS/ directory.
  3. In the MySQL database, create a user@% for yourself.

    • Be sure to give yourself appropriate permissions.
  4. Configure the redis.conf file in the ../REDIS/ folder:

    # ../REDIS/redis.conf
    
    ################################## SECURITY ###################################
    # Require clients to issue AUTH <PASSWORD> before processing any other
    # ...
    # use a very strong password otherwise it will be very easy to break.
    #
    requirepass p@ssw0rd_h3r3!

Installing

  1. Download or git this project into the parent folder.

  2. In your command line, cd into the project root location.

  3. Install some packages at the global level:

    1. Run chmod +x ./.docs/npm_global.sh to make it excutable.

    2. Run sudo ./.docs/npm_global.sh to install some important, *global packages.

      These can be utilized across ANY or your projects:

      | Package | Description | | --- | --- | | babel-cli | A next-gen (ES6) JavaScript compiler. | | bower | A package-manager for Browser plugins. | | cors | A middleware for Cross-Origin Resource Sharing. | | depcheck | A tool for analyzing the dependencies in a project | | express | A fast, unopinionated, minimalist web framework for NodeJS. | | gulp | A toolkit that helps automate development workflow tasks. | | less | The dynamic stylesheet language. | | less-plugin-clean-css | A gulp plugin for LESS -> CSS using clean-css. | | nodemon | Will watch for files changes and restart your application. |

  4. Run npm link gulp && gulp setup to:

    • Install the npm packages.
    • Install the bower components.
    • Initialize the config files.
    • Link the framework modules.

Post-Configuration

  1. In the ./config/ folder, configure the settings.js file:

    // ./config/settings.js 
    export default {
        Debug: true, // Debug‑Mode will display verbose Logs
        Port: 3001, // This is the Server's listening Port
        Public: {
            // Cache‑Age for Browser files
            Age: 365*86400, 
            // ...
        },
        Session: {
            // This should be something hard to guess, like a phrase
            Secret: '¿mYd0GiS!nmYeyE&shEs4yS@uE?',
            Age:    (((3600*1000)*4)*1),  // TTL for User Sessions
            REDIS:  {
                Host: 'localhost', // Or whereever you keep it
                Port: 6379, // Listening Port
                // The password you configured earlier
                Password: 'p@ssw0rd!',
            },
            Auth: { /* ... */ }
        }
    };
  2. Still in the ./config/ folder, configure the database.js file:

    // ./config/database.js
    export default {
        Config: {
            user:     'user', // The one you created in MySQL
            database: 'mydatabase', // The DB
            // ...
        },
        Pool: {
            HeadEx1: {
                host: 'XXX.XXX.XXX.XXX', // The eVectr IP
                // The one you created in MySQL 
                password: 'p@ssw0rd_h3r3!' 
            },
        }
    };

Launching

  1. Lastly, still in the project root, type gulp and hit ENTER to run, and watch the logs as the server starts up:

    Initial Gulp-Tasks being completed Initial gulp tasks being completed.

    Nodemon Monitoring Startup File monitoring, courtesy of nodemon.

    Node Server Startup The node server starting up.

    • If there are no glaring errors, you're done!
    • Otherwise... Sh!t..? ¯\_(ツ)_/¯
  2. In your browser, navigate to localhost:3001/api-explorer (or whatever port you chose) and you'll see the API Exploration UI. Use this to test your endpoints and/or signle sign-on functionality.

  3. Hit CTRL+C to stop the server.


Modules

dffrnt.confs

Initial default Configs used within the DFFRNT.API Framework.

dffrnt.model

A collection of SQL Utilities & MySQL connector.

dffrnt.route

An Express/Passport/MySQL-based API Router.

dffrnt.utils

A collection of useful API Utilities & PolyFills.


License

License: MIT