mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
chore: rest readme
This commit is contained in:
parent
dc6dd6c08b
commit
5464da10ae
@ -22,7 +22,7 @@ for further reading join our [Discord](https://discord.gg/zmuvzzEFz2)
|
||||
import type { DiscordUser } from '@biscuitland/api-types';
|
||||
```
|
||||
## Example for [Deno](https://deno.land/)
|
||||
```
|
||||
```ts
|
||||
import type { DiscordUser } from "https://unpkg.com/@biscuitland/api-types@1.1.0/dist/index.d.ts";
|
||||
```
|
||||
|
||||
|
@ -52,7 +52,7 @@ B:\project> node index.js
|
||||
|
||||
For node 16.+:
|
||||
```
|
||||
B:\project> node --experimenta-fetch index.js
|
||||
B:\project> node --experimental-fetch index.js
|
||||
```
|
||||
|
||||
## Links
|
||||
|
20
packages/helpers/README.md
Normal file
20
packages/helpers/README.md
Normal file
@ -0,0 +1,20 @@
|
||||
# biscuit
|
||||
|
||||
## A brand new bleeding edge non bloated Discord library
|
||||
|
||||
<img align="right" src="https://raw.githubusercontent.com/oasisjs/biscuit/main/assets/icon.svg" alt="biscuit"/>
|
||||
|
||||
## Install (for [node18](https://nodejs.org/en/download/))
|
||||
|
||||
```sh-session
|
||||
npm install @biscuitland/helpers
|
||||
yarn add @biscuitland/helpers
|
||||
```
|
||||
|
||||
for further reading join our [Discord](https://discord.gg/zmuvzzEFz2)
|
||||
|
||||
## Most importantly, helpers is:
|
||||
- Collectors
|
||||
- Builders
|
||||
- Other helper functions such as setPresence
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@biscuitland/extra",
|
||||
"name": "@biscuitland/helpers",
|
||||
"version": "1.1.0",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
@ -0,0 +1,63 @@
|
||||
# biscuit
|
||||
|
||||
## A brand new bleeding edge non bloated Discord library
|
||||
|
||||
<img align="right" src="https://raw.githubusercontent.com/oasisjs/biscuit/main/assets/icon.svg" alt="biscuit"/>
|
||||
|
||||
## Install (for [node18](https://nodejs.org/en/download/))
|
||||
|
||||
```sh-session
|
||||
npm install @biscuitland/rest
|
||||
yarn add @biscuitland/rest
|
||||
```
|
||||
|
||||
for further reading join our [Discord](https://discord.gg/zmuvzzEFz2)
|
||||
|
||||
## Most importantly, biscuit's rest is:
|
||||
An standalone rest library that is yet easy to use and easy to host on a serverless infraestructure, it is meant to be used with biscuit's libraries
|
||||
|
||||
## Example
|
||||
```ts
|
||||
import { DefaultRestAdapter } from "@biscuitland/rest";
|
||||
import Fastify from "fastify";
|
||||
|
||||
const manager = new DefaultRestAdapter({
|
||||
url: `http://localhost:port...`,
|
||||
token: "your token goes here",
|
||||
version: 10,
|
||||
});
|
||||
|
||||
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..." });
|
||||
```
|
||||
|
||||
This package can be delivered through [unpkg](https://unpkg.com/) however is not tested yet
|
Loading…
x
Reference in New Issue
Block a user