api-request-js

1.0.2 • Public • Published

npm version

Welcome to the api-request-js package!

🌐 Website

https://requestjs.netlify.app/

😧 There's a problem...

Getting data from an API is complex and hard in JavaScript. A quick google search will direct you to a difficult code block that either use fetch or axios.
This SCARES off beginners.

  • Which one do I use?
  • Like what is the await keyword?
  • When do I use it?
  • But wait what is async?
  • How does async even work?
  • How do I error handle? .catch?
  • I can't even download an image from this url!! Ahhrr!!!
  • What's a Promise? Whaaa?!!??
  • This totals over 30 lines of code (depending on your use case). Meanwhile in Python it's literally one line - requests.get(url).

With api-request-js we dumb down api calls. Now you can get data with just one line.

🚀 Install & Use!

npm i api-request-js
const request = require("api-request-js")
let data = request.getRequest(url, path)
request.log(data)

😧 Examples...

Solving math problems using the Newton Math Solver API:

const request = require("api-request-js")

let data = request.getRequest("https://newton.now.sh/api/v2/factor/x^2-1")
request.log(data)

Downloading Images from the Unsplash Image Generator API:

const request = require("api-request-js")
let data = request.getRequest("https://source.unsplash.com/random/", "/Users/Billy/Desktop/Images/")

Readme

Keywords

Package Sidebar

Install

npm i api-request-js

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

3.89 kB

Total Files

3

Last publish

Collaborators

  • eric-prog