Description
Heart Server is an orchestrator of every other heart-*
modules.
As an orchestrator, it allows to start webpage analysis. And it does so by exposing a small API.
Technically, it is a server that starts on 127.0.0.1 (port is customizable, default to 3000).
Example: if you install this package plus Heart Observatory, you will have an API that expose the /observatory
endpoint. Requesting this endpoint will start a webpage analysis using the Mozilla Observatory service.
Installation
- Add the package to your project:
npm i @fabernovel/heart-server
- [Optional] Add the following environment variables:
# Port that the server will listen to
PORT=1234
# Express configuration: http://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production
NODE_ENV=production
Usage
Vanilla JS
const HeartServer = require('@fabernovel/heart-server');
HeartServer.default.start();
TypeScript
import HeartServer from '@fabernovel/heart-server';
HeartServer.start();