-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
git clone https://github.com/samchon/tgrid.example.shared-worker npm install npm run build npm start
git clone https://github.com/samchon/tgrid.example.shared-worker npm install npm run build npm start
/** * @packageDocumentation * @module api.functional.calculate * @nestia Generated by Nestia - https://github.com/samchon/nestia */ //================================================================ import type { IConnection, Primitive } from "@nestia/fetcher"; import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher"; import { WebSocketConnector } from "tgrid"; import type { Driver } from "tgrid"; import type { ICalcConfig } from "../../interfaces/ICalcConfig"; import type { ICalcEventListener } from "../../interfaces/ICalcEventListener"; import type { ICompositeCalculator } from "../../interfaces/ICompositeCalculator"; import type { IScientificCalculator } from "../../interfaces/IScientificCalculator"; import type { ISimpleCalculator } from "../../interfaces/ISimpleCalculator"; import type { IStatisticsCalculator } from "../../interfaces/IStatisticsCalculator"; /** * Health check API (HTTP GET). * * @controller CalculateController.health * @path GET /calculate/health * @nestia Generated by Nestia - https://github.com/samchon/nestia */ export async function health(connection: IConnection): Promise { return PlainFetcher.fetch(connection, { ...health.METADATA, path: health.path(), }); } export namespace health { export type Output = Primitive; export const METADATA = { method: "GET", path: "/calculate/health", request: null, response: { type: "application/json", encrypted: false, }, status: null, } as const; export const path = () => "/calculate/health"; } /** * Prepare a composite calculator. * * @controller CalculateController.composite * @path /calculate/composite * @nestia Generated by Nestia - https://github.com/samchon/nestia */ export async function composite( connection: IConnection, provider: composite.Provider, ): Promise { const connector: WebSocketConnector< composite.Header, composite.Provider, composite.Listener > = new WebSocketConnector(connection.headers ?? ({} as any), provider); await connector.connect( `${connection.host.endsWith("/") ? connection.host.substring(0, connection.host.length - 1) : connection.host}${composite.path()}`, ); const driver: Driver = connector.getDriver(); return { connector, driver, }; } export namespace composite { export type Output = { connector: WebSocketConnector; driver: Driver; }; export type Header = ICalcConfig; export type Provider = ICalcEventListener; export type Listener = ICompositeCalculator; export const path = () => "/calculate/composite"; } /** * Prepare a simple calculator. * * @controller CalculateController.simple * @path /calculate/simple * @nestia Generated by Nestia - https://github.com/samchon/nestia */ export async function simple( connection: IConnection, provider: simple.Provider, ): Promise { const connector: WebSocketConnector< simple.Header, simple.Provider, simple.Listener > = new WebSocketConnector(connection.headers ?? ({} as any), provider); await connector.connect( `${connection.host.endsWith("/") ? connection.host.substring(0, connection.host.length - 1) : connection.host}${simple.path()}`, ); const driver: Driver = connector.getDriver(); return { connector, driver, }; } export namespace simple { export type Output = { connector: WebSocketConnector; driver: Driver; }; export type Header = ICalcConfig; export type Provider = ICalcEventListener; export type Listener = ISimpleCalculator; export const path = () => "/calculate/simple"; } /** * Prepare a scientific calculator. * * @controller CalculateController.scientific * @path /calculate/scientific * @nestia Generated by Nestia - https://github.com/samchon/nestia */ export async function scientific( connection: IConnection, provider: scientific.Provider, ): Promise { const connector: WebSocketConnector< scientific.Header, scientific.Provider, scientific.Listener > = new WebSocketConnector(connection.headers ?? ({} as any), provider); await connector.connect( `${connection.host.endsWith("/") ? connection.host.substring(0, connection.host.length - 1) : connection.host}${scientific.path()}`, ); const driver: Driver = connector.getDriver(); return { connector, driver, }; } export namespace scientific { export type Output = { connector: WebSocketConnector; driver: Driver; }; export type Header = ICalcConfig; export type Provider = ICalcEventListener; export type Listener = IScientificCalculator; export const path = () => "/calculate/scientific"; } /** * Prepare a statistics calculator. * * @controller CalculateController.statistics * @path /calculate/statistics * @nestia Generated by Nestia - https://github.com/samchon/nestia */ export async function statistics( connection: IConnection, provider: statistics.Provider, ): Promise { const connector: WebSocketConnector< statistics.Header, statistics.Provider, statistics.Listener > = new WebSocketConnector(connection.headers ?? ({} as any), provider); await connector.connect( `${connection.host.endsWith("/") ? connection.host.substring(0, connection.host.length - 1) : connection.host}${statistics.path()}`, ); const driver: Driver = connector.getDriver(); return { connector, driver, }; } export namespace statistics { export type Output = { connector: WebSocketConnector; driver: Driver; }; export type Header = ICalcConfig; export type Provider = ICalcEventListener; export type Listener = IStatisticsCalculator; export const path = () => "/calculate/statistics"; }
Related posts
-
I made Swagger/OpenAPI type definitions and converter library
-
[Typia] I made Protocol Buffer library of TypeScript, easiest in the world
-
[NestJS] I made backend server simulator without backend server
-
[Nestia] Make NestJS 30x faster with fastify
-
[Nestia] I made automatic e2e test functions generator for NestJS