FrancescoSaverioZuppichini / API-Class

Licence: other
A utility class for calling apis CRUD methods

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to API-Class

Opensourceresources
Free opensource Learning Resources related to Web-Development A to Z 🔥❤
Stars: ✭ 210 (+135.96%)
Mutual labels:  webdevelopment
live-reload-vanilla-website-template
Template to build a website without a front-end framework, including transpilation of ES6+ JavaScript and Sass support
Stars: ✭ 47 (-47.19%)
Mutual labels:  webdevelopment
nubuilder4
This repository is no longer maintained!
Stars: ✭ 22 (-75.28%)
Mutual labels:  webdevelopment
Writing
📚📝 Notes on the journey
Stars: ✭ 234 (+162.92%)
Mutual labels:  webdevelopment
BackEnd-Squad
Back End Squad Roadmap
Stars: ✭ 24 (-73.03%)
Mutual labels:  webdevelopment
todo
An example todo application with Go!
Stars: ✭ 61 (-31.46%)
Mutual labels:  webdevelopment
One Html Page Challenge
Can you create something cool without modern tools?
Stars: ✭ 205 (+130.34%)
Mutual labels:  webdevelopment
intro-web-dev-2017aut
Site for course "Introduction to Web Design and Development."
Stars: ✭ 13 (-85.39%)
Mutual labels:  webdevelopment
zkit
zKit, components for modern web.
Stars: ✭ 38 (-57.3%)
Mutual labels:  webdevelopment
web-development-resources
Awesome Web Development Resources.
Stars: ✭ 5,359 (+5921.35%)
Mutual labels:  webdevelopment
Test-Bank
Interview preparation and practice problems
Stars: ✭ 43 (-51.69%)
Mutual labels:  webdevelopment
Web-dev-mini-projects
The repository contains the list of awesome✨ & cool web development beginner-friendly✌️ projects!
Stars: ✭ 291 (+226.97%)
Mutual labels:  webdevelopment
accessible-name-automation-proof-of-concept
This is an experiment based on Accessibility Object Model (AOM). It tries to demonstrate that it is theoretically possible (in a certain way) to predict what the screen reader will say by focusing on semantic and non semantic elements with a bit of automated testing, thus reducing the need for manual testing.
Stars: ✭ 15 (-83.15%)
Mutual labels:  webdevelopment
Javascript Articles
Monthly Series - Top 10 JavaScript Articles
Stars: ✭ 229 (+157.3%)
Mutual labels:  webdevelopment
web-development-learning-resources
💪 Resources to become a senior web developer
Stars: ✭ 21 (-76.4%)
Mutual labels:  webdevelopment
Mac
macOS Mojave v. 10.14 setup for developers.
Stars: ✭ 209 (+134.83%)
Mutual labels:  webdevelopment
Portfolio-Website
Portfolio Website build using HTML5, CSS3, JavaScript and jQuery
Stars: ✭ 109 (+22.47%)
Mutual labels:  webdevelopment
Awesome-Projects-Collection
This is a beginner-friendly repo to make a collection of some unique and awesome projects. Everyone in the community can benefit & get inspired by the amazing projects present over here.
Stars: ✭ 175 (+96.63%)
Mutual labels:  webdevelopment
hacktoberfest-2021
This repository is made for people who wanted to learn about open-source and paricipate in Hactoberfest 2021.
Stars: ✭ 19 (-78.65%)
Mutual labels:  webdevelopment
Technocrats-HacktoberFest
This Repository invites freelancer friendly neighbourhood developers to contribute to open source .
Stars: ✭ 12 (-86.52%)
Mutual labels:  webdevelopment

API Class

faster way to generate API calls with axios

Installation

You can install the package using npm

npm install api-class

https://www.npmjs.com/package/api-class

Usage

Create an API instance by import the API class from api-class. As parameter pass the basic url of your api.

const myAPI = new API({ url: '/api' })

Endpoints

To add an endpoint, use the .createEntity method.

const myAPI = new API({ url: '/api' })
myAPI.createEntity({ name : 'posts' })
myApi.endpoints.posts.getAll()

Methods

All API's endpoints have basic CRUD operations

getAll(params, config)
getOne({ id }, config)
create(toCreate, config)
update(toUpdate, config)
delete({ id }, config)

Q&A

How to pass headers to axios?

const myAPI = new API({ url: '/api' })
myAPI.createEntity({ name : 'posts' })
myAPI.endpoints.posts({ id: 0 },  { headers: {....} } )

You can check it out my medium article for further informations

https://medium.com/@FrancescoZ/how-to-call-api-in-a-smart-way-2ca572c6fe86

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].