Simplified api to create server using node.js.
dmail/server github repository publishes @dmail/server
package on github and npm package registries.
@dmail/server
helps to start server with a simplified api to focus on writing your application code. The api make your code easier to compose and test in isolation.
The following code starts a server listening to http://127.0.0.1:8080
responding Hello world
as plain text.
import { startServer } from "@dmail/server"
startServer({
protocol: "http",
ip: "127.0.0.1",
port: 8080,
requestToResponse: () => {
return {
status: 200,
headers: {
"content-type": "text/plain",
},
body: "Hello world",
}
},
})
Api can be found in their own pages
npm install @dmail/server@2.4.0