Skip to content

Repository files navigation

ForgeAPI

ForgeAPI, the best way to interact with your ForgeScript bot and it's server.

@tryforge/forge.api@tryforge/forgescriptDiscord

How to use

Download from npm:

npm i @tryforge/forge.api

in your client initialization:

const{ ForgeAPI }=require("@tryforge/forge.api")constapi=newForgeAPI({port: number,logLevel?: number,auth: {bearer?: boolean,type: number,code?: string|string[],ip?: string|string[]}})constclient=newForgeClient({
...
"extensions": [api]})api.router.load("path")
nameInputdescriptionRequired
portnumberThe port to open for the apitrue
logLevel0/1/20 = none | 1 = all | 2 = debugfalse
auth.bearerbooleanIf true the client will make a bearer token.false
auth.type0/1/20 = no auth | 1 = either token or ip | 2 = both token and iptrue
auth.codestring[]SecretKey used for non bearer authfalse
auth.ipstring[]The ips who are allowed to make requests.false

Making Routes on <path>/<filename>

module.exports={url: '/string',method: "type",auth: boolean,handler: asyncfunction(ctx){<code>},}
nameInputdescriptionRequired
Url/stringThe endpoint to appoint this totrue
methodestringGet / Put / Post / Delete / patch / options / trace / connecttrue
authBooleanIf false ForgeAPI wont check for authentication (ip/token)true
handlerstringthe code to run if connected successfullytrue

You can also check our endpoint templates at our template brench.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Agglos-007
💻

Lynnux
⚠️

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages