common-things-api
v1.0.1
Published
Isomorphic Library that can make calls to many endpoints and api handling the logical aspect while you just decide the data to be fetched and how it should be consumed
Readme
Free Customizable Package
Common Things API is an open-source package that looks forward in providing a developer-friendly experience when making network request as it provides tons of api and pre-configuration of each api that can be consumed with just a single line of code without having you to craft out a logical network request saving time and lines of code. A product of lots of commonly used apis as listed below:
Let grow the list together by contributing.
Contributing
You’ll need to have Node 10.16.0 or later version on your local development machine (but it’s not required on the server). I recommend using the latest LTS version.
To create a new app, you have to:
Begin by
- Fork the repo
- Clone this repository to establish your own local copy. This process is straightforward and ensures you have all the necessary files and resources at your fingertips. You can find step-by-step instructions in this helpful article: Cloning a repository on GitHub.com.
- Run the app using the command
npm i - Check the
srcfolder to get on with the codebase.
What's included
rollupjs- The JavaScript module bundler
Usage
You can re-use this for whatever you want or to build something cool with it.
install package:
Install from the command line:
$ npm install @certsoftt/[email protected]
or
$ npm i common-things-apiInstall via package.json:
"@certsoftt/common-things-api": "1.0.0"- Using the
Get classto fetch data. For instance, fetchingpostsfromjsonplaceholder api
import {Get} from "common-things-api"
//or import {Get} from "@certsoftt/common-things-api"
let posts = new Get("posts").api()this fetches posts from jsonplaceholder api. The api() accepts 1 optional argument which is your endpoint query. For instance, fetching a single post with an id of 50
let post = new Get("posts").api("?id=50")or programmatically:
let id = value // dynamic value
let post = new Get("posts").api(`?id=${id}`)License
Licensed under the MIT license.
