A wrapper for creating HTTP/HTTPS servers
npm install @loopback/http-serverThis package implements the HTTP / HTTPS server endpoint for LoopBack 4 apps.
This is an internal package used by LoopBack 4 for creating HTTP / HTTPS server.
To use this package, you'll need to install @loopback/http-server.
``sh`
npm i @loopback/http-server
@loopback/http-server should be instantiated with a request handler function,
and an HTTP / HTTPS options object.
`js`
const httpServer = new HttpServer(
(req, res) => {
res.end('Hello world');
},
{port: 3000, host: ''},
);
Instance methods of HttpServer.
| Method | Description |
| --------- | ----------------- |
| start() | Starts the server |stop()
| | Stops the server |
Instance properties of HttpServer.
| Property | Description |
| ---------- | ---------------------- |
| address | Address details |host
| | host of the server |port
| | port of the server |protocol
| | protocol of the server |url
| | url the server |
Run npm test` from the root folder.
See
all contributors.
MIT