Deno.js Servest HTTP Server Framework Library in TypeScript Full Tutorial With Example For Beginners

 

 

servest

Build Status https://img.shields.io/github/tag/keroxp/servest.svg license

 

🌾A progressive http server for Deno🌾

 

Description

 

Servest is a http module suite for Deno. It is composed of three major APIs of HTTP protocol:

 

  • App API: General purpose HTTP routing server.
  • Server API: Low-level HTTP API for processing HTTP/1.1 requests.
  • Agent API: Low-level API for managing HTTP/1.1 Keep-Alive connection to the host.

 

See also  Deno.js QR Code Module Tutorial to Create QR Codes and Print in on Terminal in TypeScript Full Project For Beginners

In order to experiment and be progressive, we have our own implementation of HTTP/1.1 server apart from std/http.

 

Usage

 

 

server.ts

 

 

import { createApp } from "https://deno.land/x/servest@v1.3.1/mod.ts";
const app = createApp();
app.handle("/", async (req) => {
  await req.respond({
    status: 200,
    headers: new Headers({
      "content-type": "text/plain",
    }),
    body: "hello deno!",
  });
});
app.listen({ port: 8888 });

 

 

Now you need to run the above file with --allow-net flag as shown below

See also  Deno.js Bitly API to Create URL Shortener Using deno-bitly Library in TypeScript Full Project For Beginners

 

 

deno run --allow-net server.ts

 

 

 

 

It will start the deno app at port 8888

 

 

Leave a Reply