@sswahn/server

1.0.1 • Public • Published

Server · License npm version Weekly Downloads

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

Package Sidebar

Install

npm i @sswahn/server

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

4.98 kB

Total Files

5

Last publish

Collaborators

  • sswahn