JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q63664F
  • License MIT

A modern, opinionated and simple microservices stack built on Express.

Package Exports

  • srv-cli

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (srv-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

▼srv

▼ A modern, opinionated and simple microservices stack built on Express.

Currently a work-in-progress project!

npm-version

Why?

Creating services using the microservices architecture pattern can involve a lot of repeated boilerplate code including server, logging, documentation, transpilation and other middleware.

srv helps combine the common boilerplate code, while allowing you to extend as needed.

Features

  • Minimal CLI + Framework over Express
  • Babel Transpilation
  • Logging
  • RESTful Documentation Generation
  • CORS configuration

Included Modules

  • Express — Minimalist web framework
  • Babel — Javascript Transpilation.
  • Winston Logging — A multi-transport async logging library for node.js.
  • apiDoc — Inline Documentation for RESTful web APIs.

Install

$ npm install -g srv-cli
$ srv --help

Example

Create hello.js with a default export:

export default function hello(app) {
    app.get('/hello', (req, res) => {
        res.send("Hello world!");
    })
}

The express context will be passed into the default export, giving you full access to the express API. No need to write any express boilerplate code.

You can run the application directly with srv:

$ srv hello.js

▼ Babel transpiled.
▼ Ready! Listening on: http://0.0.0.0:3000

Any ES2015 code will automatically be transpiled (via babel), then served at the default host + port. See the CLI Reference for more options and features.

CLI Reference

$ srv --help
Usage: srv [options] [command] entrypoint.js

Commands:

  help  Display help

Options:

  -D, --docs [value]  Generate Docs from folder
  -h, --help          Output usage information
  -H, --host [value]  Host to listen on
  -n, --no-babel      Skip Babel transformation
  -p, --port <n>      Port to listen on
  -v, --version       Output the version number

Generating Documentation

TODO

Babel

TODO

Logging

TODO

CORS

TODO

Adding Middleware

TODO

Development

TODO

TODO

  • Caching
  • Default Configuration
  • Environment Variables

License

MIT