3.0.7 • Published 9 months ago

@biscuitland/rest v3.0.7

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
9 months ago

@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.

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..." });

Links

3.0.7

9 months ago

3.0.6

11 months ago

3.0.5

11 months ago

3.0.4

12 months ago

3.0.2

12 months ago

3.0.1

12 months ago

3.0.0

12 months ago

2.3.0

1 year ago

2.2.3

1 year ago

2.1.2

2 years ago

2.2.0

2 years ago

2.2.2

1 year ago

2.1.1

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.6

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago