Get Started

Servest is a suite of HTTP/1.1 modules. There are three major API for handling HTTP stuffs.

If you want to build HTTP server anyway, Router API is the best choice. Router API provides a high-level interfaces for building general purpose HTTP server (site, application, api or file server ...etc).

// Copyright 2019 Yusuke Sakurai. All rights reserved. MIT license.
import { createRouter } from "https://servestjs.org/@v0.30.0/router.ts";
const router = createRouter();
router.handle("/", async req => {
  await req.respond({
    status: 200,
    headers: new Headers({
      "content-type": "text/plain"
    }),
    body: "Hello, Servest!"
  });
});
router.listen(":8899");
$ deno --allow-net https://servestjs.org/example/get_started.ts

Advanced API

If you are familiar with HTTP/1.1 protocol and programing TCP server, Server API and Agent API may be useful for building customized HTTP libraries.