npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

redux-api-manager

v1.1.2

Published

Centralize API management and simplify calls

Readme

redux-api-manager

Centralize API management and simplify calls

NPM JavaScript Style Guide

Install

npm install --save redux-api-manager

FSA actions

This project use Flux Standard Action

{
  type:'REDUX_ACTION_TYPE'
  payload:{'object return by the route'},
  error:false
}

Usage

create, update, read and delete a ressource

import API from 'redux-api-manager';

let api = new API({url: 'http://api.awesome.com'})

//Create endpoint
let companyEndpoint = api.endpoint('companies')

companyEndpoint.create({name:'Amazon'})
// HTTPS POST api.awesome.com/companies and dispatch CREATE_COMPANIES

companyEndpoint.update({id:1,name:'Google'})
// HTTPS PUT api.awesome.com/companies and dispatch UPDATE_COMPANIES

companyEndpoint.read()
// HTTPS GET api.awesome.com/companies, dispatch REQUEST_COMPANIES and RECEIVE_COMPANIES

companyEndpoint.delete(1)
// HTTPS DELETE api.awesome.com/companies/1 and dispatch REMOVE_COMPANIES

JWT authentification

const credential = {email: '[email protected]', password: 'secure'}
let authEndpoint = api.endpoint('auth')
authEndpoint.login(credential)
// HTTPS POST api.awesome.com/login, dispatch REQUEST_AUTH and RECEIVE_AUTH
// Store the token in the localStorage

let companyEndpoint = api.endpoint('companies')
companyEndpoint.auth()
companyEndpoint.read()
// HTTPS GET api.awesome.com/companies, dispatch REQUEST_COMPANIES and RECEIVE_COMPANIES

Nested route

let companyLeaders = api.endpoint('leaders')
companyLeaders.nested('companies',1)

companyLeaders.create({name:'Larry Page'})
// HTTPS POST api.awesome.com/companies/1/leaders and dispatch CREATE_COMPANIES_LEADERS

companyLeaders.update({id:1,name:'Sundar Pichai'})
// HTTPS PUT api.awesome.com/companies/1/leaders and dispatch UPDATE_COMPANIES_LEADERS

companyLeaders.read()
// HTTPS GET api.awesome.com/companies/1/leaders, dispatch REQUEST_COMPANIES_LEADERS and RECEIVE_COMPANIES_LEADERS

companyLeaders.delete(1)
// HTTPS DELETE api.awesome.com/companies/1/leaders/1 and dispatch REMOVE_COMPANIES_LEADERS

Nested route without params

api.endpoint('top5').nested('companies').read()
// HTTPS GET api.awesome.com/companies/top5, dispatch REQUEST_COMPANIES_TOP5 and RECEIVE_COMPANIES_TOP5

Rename Redux action

api.endpoint('companies').renameAction('COMPANIES_DETAILS').read(1)
// HTTPS GET api.awesome.com/companies/1, dispatch REQUEST_COMPANIES_DETAILS and RECEIVE_COMPANIES_DETAILS

File upload

let companyEndpoint = api.endpoint('companies')
const useJson = false
const pictureFile = event.target.files[0]
// get the picture file with onChange on <imput type="file" onChange={onChangeFile} >
companyEndpoint.create({name:'Larry Page',picture:pictureFile},useJson)
// HTTPS POST api.awesome.com/companies/1/leaders and dispatch CREATE_LEADERS

License

MIT © Thibaud05