HTTP server provider for @mdf.js based on express.
Using npm:
npm install @mdf.js/http-server-provider
Using yarn:
yarn add @mdf.js/http-server-provider
Check information about @mdf.js providers in the documentation of the core module @mdf.js/core.
The provider implemented in this module wraps an HTTP server based on express to provide a simple HTTP server.
import { HTTP } from '@mdf.js/http-server-provider';
const client = HTTP.Factory.create({
name: `myHTTPServerProvider`,
config: {
/** Port for the HTTP server */
port: 8080,
/** Host for the HTTP server */
host: 'localhost',
/** Express app configuration */
app: Express,
},
logger: myLoggerInstance,
useEnvironment: true,
});
Defaults:
{
port: 8080,
host: 'localhost',
app: /* Default static web */,
}
Environment: remember to set the useEnvironment
flag to true
to use these environment variables.
{
port: process.env['CONFIG_SERVER_PORT'],
host: process.env['CONFIG_SERVER_HOST'],
}
Checks included in the provider:
running
if the server has been started properly, stopped
if the server has been stopped or is not initialized, or error
if the server could not be started.
running
if the server is running, stopped
if the server is stopped, or error
if the server could not be started.pass
if the server is running, fail
could not be started or warn
if the server is stopped.error
state (status fail
), the error message is shown.service
.{
"[mdf-http-server:status]": [
{
"status": "pass",
"componentId": "00000000-0000-0000-0000-000000000000",
"observedValue": "running",
"componentType": "service",
"output": undefined,
},
],
}
8080
): Port for the HTTP server.localhost
): Host for the HTTP server.Copyright 2024 Mytra Control S.L. All rights reserved.
Use of this source code is governed by an MIT-style license that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.