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
- 📖 Hello, world! Retrieving on
<h1>Hello, world!</h1>
HTML code by HTTP. - 📖 HTTPS support Serving of both
HTTP
andHTTPS
. - 📖 Routing and controllers Defining the routing without and with controllers.