Server ·
A simple, robust, and extendable server utility for performing HTTP requests and streamlining CRUD operations.
Features
- Concise methods for GET, POST, PUT, and DELETE requests.
- Built-in type checking for better error handling.
- Customizable headers for each request.
- Simplified JSON responses.
Installation
Using npm:
npm install @sswahn/server
Usage
Import Server
import server from '@sswahn/server'
Get Request
const response = await server.get(api)
Post Request
const response = await server.post(api, request)
Put Request
const response = await server.put(api, request)
Delete Request
const response = await server.delete(api)
Custom Headers
For any request, you can provide custom headers:
const customHeaders = {
'Authorization': 'Bearer YOUR_TOKEN'
}
server.get(api, customHeaders)
License
Server is MIT Licensed