Skip to content

Start a server

There are several platforms where back-end JavaScript can run (Node, Deno, Bun). That’s why @duplojs/http provides multiple interfaces so you can start a server in different environments.

Simple start with Node

ts
import { 
createHub
} from "@duplojs/http";
import {
createHttpServer
} from "@duplojs/http/node";
const
hub
=
createHub
({
environment
: "DEV" });
await
createHttpServer
(
hub
,
{
host
: "localhost",
port
: 1506,
}, );

To do that, simply import the createHTTPServer function from @duplojs/http/node and provide your Hub along with the parameters needed to make your server functional.

Use another environment?

If you want to use other environments, check the API page for interfaces.

Released under the MIT License.