express-api-tools-runner

0.1.0 • Public • Published

express-api-tools-runner

This is a complimentary module to the express-api-tools module which makes building pragmatic api endpoints easy.

This runner also serves a frontend from the /app directory.

Usage

Usage is pretty simple.

Add this package as a dependency to your project and add this to your package.json

"scripts": {
    "run": "node ./node_modules/express-api-tools-runner/launcher.js log"
}

This will start the webserver on port 8088.

The frontend app should be located inside your apps /app directory and have an index.html file.

The backend modules should be placed in the /modules directory and export the following function

'api': (express, baseUrl) => {
    registerEndpoint(express, baseUrl + '/<YOUR-URL>', <CACHE-TIME IN MS>, function() {
        <RETURN JSON HERE>
    });
}

Don't forget to import the registerEndpoint

registerEndpoint = require('express-api-tools').register_endpoint.default;

Todo

  • Make port configurable
  • Make frontend directory configurable

Readme

Keywords

Package Sidebar

Install

npm i express-api-tools-runner

Weekly Downloads

1

Version

0.1.0

License

none

Unpacked Size

3.82 kB

Total Files

4

Last publish

Collaborators

  • athaphian