socram03 02b8bd0d28 fix(ws): gateway resume now it works correctly
feat(ws): more usesfull methods in sharder
fix(helpers): data arrays fixed
ci: change rome to biome

Co-authored-by: MARCROCK22 <MARCROCK22@users.noreply.github.com>
2023-11-08 20:16:28 -04:00
..
2023-06-29 07:13:43 -05:00

@biscuitland/rest

Most importantly, biscuit's rest is:

A standalone rest library that is yet easy to use and easy to host on a serverless infrastructure, it is meant to be used with biscuit's libraries.

biscuit

Install (for node18)

npm install @biscuitland/rest
yarn add @biscuitland/rest

Example (Standalone rest)

import { BiscuitREST } from "@biscuitland/rest";
import Fastify from "fastify";

const manager = new BiscuitREST({
    api: "http://any.rest.proxy/",
    version: 10,
    token: "your token goes here"
});

const app = Fastify({});

app.all("*", (req, reply) => {
    let response: unknown;

    switch (req.method) {
    case "GET":
        response = await rest.get(req.url, req.body);
    break;
    case "POST":
        response = await rest.post(req.url, req.body);
    break;
    case "PUT":
        response = await rest.put(req.url, req.body);
    break;
    case "PATCH":
        response = await rest.patch(req.url, req.body);
    break;
    case "DELETE":
        response = await rest.delete(req.url, req.body);
    break;
    }

    if (response)
        reply.status(200).send({ status: 200, data: response });

    else
        reply.status(204).send({ status: 204, data: null });
});

app.listen({ port: "port..." });