Laravel Forge JavaScript SDK
Introduction
Laravel Forge JavaScript SDK is a complete JavaScript wrapper for the official Laravel Forge API. It was designed to be compatible with both Node.js backends and client-side browsers.
Getting Started
Installation
# Using Yarn (recommended)yarn add @geoffcodesthings/forge-js# Using NPMnpm install --save @geoffcodesthings/forge-js
Basic Usage
The SDK uses the fetch
api to make http requests to the Forge API. Because these calls are asynchronous, be sure to use async/await
. Of course, you could resolve the promise with .then()
if you prefer.
import Forge from '@geoffcodesthings/forge-js';const forge = new Forge('API_TOKEN');const servers = await forge.servers.get();console.log(servers);