@yamato-daiwa/backend

Backend framework with build-in TypeScript type safety. Intended to be used in full-stack applications where both client and server part written in TypeScript.

Usage no npm install needed!

<script type="module">
  import yamatoDaiwaBackend from 'https://cdn.skypack.dev/@yamato-daiwa/backend';
</script>

README

@yamato-daiwa/backend

Back-end framework with build-in TypeScript type safety. Intended to be used in full-stack applications where both client and server part written in TypeScript.

Installation

npm i @yamato-daiwa/backend -E

Quick example

import { HTTP_Methods, HTTP_StatusCodes } from "@yamato-daiwa/es-extensions";
import { Server, Request, Response } from "@yamato-daiwa/backend";


Server.initializeAndStart({
  host: "127.0.0.1",
  HTTP: { port: 1337 },
  routing: [
    {
      route: { type: HTTP_Methods.get, pathTemplate: "/" },
      async handler(request: Request, response: Response): Promise<void> {
        console.log(request);
        return response.submit({
          statusCode: HTTP_StatusCodes.OK,
          HTML_Content: "<h1>Hello, world!</h1>"
        });
      }
    }
  ]
});

See the "Hello, world!" tutorial for the details.

Functionality tutorials