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

easer

v7.0.3

Published

A simple, generic express server with built-in authentication and authorization

Downloads

178

Readme

easer

Actions Status unstable npm version Coveralls

About

The main goal with the implementation of easer is to have a general purpose, cloud ready server that connects client applications with backend services using configuration only, but no infrastructure coding is required.

The clients want to access to the backend services through standard synchronous REST APIs, and/or asynchronous websocket channels. easer makes this possible, and it needs only some configuration parameter and a standard description of the REST API.

easer is a generic web server built on top of express, that has pre-built middlewares and components to deliver the following features:

  • Acts as static web content server.
  • Provides REST API that is described by Swagger/OpenApi descriptors.
  • Serves examples defined in the swagger files in mocking mode.
  • Acts as edge server. Accomplishes messaging gateway functionality that maps the REST API calls to synchronous NATS calls towards service implementations, that can be implemented in different programming languages.
  • Connects the frontend applications to backing services and pipelines via asynchronous topic-like messaging channels using websocket and NATS.
  • Implements internal features required for graceful shutdown, logging, monitoring, etc.

These are the typical usage scenarios:

  1. Static web server.
  2. Mock server.
  3. Edge server / NATS Gateway: Exposes Micro Services through the REST API via NATS topics.
  4. WS/NATS Gateway: WebSocket Server and Gateway to NATS topics using Pattern Driven Micro Service calls and asynchronous data pipelines.

Visit the easer project website or download the PDF version to read the detailed documentation.

Prerequisites

In order to run the server, you need to have the Node.js and npm installed on your machine.

Installation

The easer is made to act as a standalone application server, so it's preferred installation is:

    npm install -g easer

For development purposes clone the easer server into a folder:

    clone [email protected]:/easer.git

Install the required dependencies:

    cd easer
    npm install

Usage

Start the server

In global mode you can start the server with the easer command. To get help, execute the following:

    easer --help

    Options:
          --version          Show version number                           [boolean]
      -c, --config           The name of the configuration file
                                                             [default: "config.yml"]
      -b, --basePath         The base-path URL prefix to each REST endpoints
                                                             [string] [default: "/"]
      -d, --dumpConfig       Print the effective configuration object to the console
                                                          [boolean] [default: false]
      -l, --logLevel         The log level                [string] [default: "info"]
      -t, --logFormat        The log (`plainText` or `json`)
                                                     [string] [default: "plainText"]
      -p, --port             The port the server will listen[string] [default: 3007]
      -r, --restApiPath      The path to the REST API descriptors
                                   [string] [default: "/home/tombenke/topics/easer"]
      -s, --useCompression   Use middleware to compress response bodies for all
                             request                      [boolean] [default: false]
      -u, --useMessaging     Use messaging middleware to forward REST API calls
                                                          [boolean] [default: false]
          --topicPrefix      The topic prefix for messaging based forwarding of REST
                             API calls                   [string] [default: "easer"]
          --parseRaw         Enable the raw body parser for the web server.
                                                           [boolean] [default: true]
          --parseJson        Enable the JSON body parser for the web server.
                                                          [boolean] [default: false]
          --parseXml         Enable the XML body parser for the web server.
                                                          [boolean] [default: false]
          --parseUrlencoded  Enable the URL Encoded body parser for the web server.
                                                          [boolean] [default: false]
      -n, --natsUri          NATS server URI used by the nats adapter.
                                       [string] [default: ["nats://localhost:4222"]]
      -w, --useWebsocket     Use WebSocket server and message forwarding gateway
                                                          [boolean] [default: false]
      -i, --inbound          Comma separated list of inbound NATS topics to forward
                             through websocket                [string] [default: ""]
      -o, --outbound         Comma separated list of outbound NATS topics to forward
                             towards from websocket           [string] [default: ""]
      -m, --enableMocking    Enable the server to use examples data defined in
                             swagger files as mock responses.
                                                          [boolean] [default: false]
          --help             Show help                                     [boolean]

During development, execute the following command in the project folder:

Start the server:

    $ npm start ./dist/app.js

    2019-05-11T15:21:56.389Z [[email protected]] info: Start up webServer
    2019-05-11T15:21:56.414Z [[email protected]] info: Express server listening on port 3007
    2019-05-11T15:21:56.415Z [[email protected]] info: App runs the jobs...

Open the http://localhost:3007/ URL with browser and check the server log. You should see something like this:

    2019-05-11T15:23:03.550Z [[email protected]] info: HTTP GET /
    2019-05-11T15:23:03.557Z [[email protected]] info: HTTP GET /docs/bootstrap/css/bootstrap.min.css
    2019-05-11T15:23:03.558Z [[email protected]] info: HTTP GET /docs/stylesheets/jumbotron-narrow.css
    2019-05-11T15:23:05.186Z [[email protected]] info: HTTP GET /docs/assets/ico/favicon.ico

Server configuration

See configuration page.