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 🙏

© 2024 – Pkg Stats / Ryan Hefner

axe-api-client

v3.0.0-rc-3

Published

axe-api-client is a native JavaScript client for Axe API servers.

Downloads

161

Readme

axe-api-client is a native JavaScript client for Axe API servers.

You can send insert, update, delete, and fetch data from Axe API servers without pain. axe-api-client has advanced query support with the active record pattern.

⚙️ Config

import { api } from "axe-api-client";

api.setConfig({
  baseURL: "https://bookstore.axe-api.com/api/v1",
  headers: {},
  params: {},
});

api.interceptors.addRequest((request: RequestInit) => {
  return request;
});

api.interceptors.addResponse((response: Response) => {
  // console.log(response);
});

➕ Insert

const response = await api.resource("users").insert({
  name: "Karl",
  surname: "Popper",
});

📤 Post

const response = await api.resource("users").post({
  name: "Karl",
  surname: "Popper",
});

🔄 Update

const response = await api.resource("users").update({
  name: "Karl",
  surname: "Popper",
});

🩹 Patch

const response = await api.resource("users").patch({
  name: "Karl",
  surname: "Popper",
});

✏️ Put

const response = await api.resource("users").put({
  name: "Karl",
  surname: "Popper",
});

🗑️ Delete

const response = await api.resource("users").delete();

🔍 Query

import { api } from "axe-api-client";

const data = await api.resource("users").paginate();

📝 Fields

const response = await api
  .resource("users")
  .fields("name", "surname", "email")
  .paginate();

🧩 Sorting

const response = await api
  .resource("users")
  .fields("name", "surname", "email")
  .sort("name")
  .sort("surname", "DESC")
  .sort("email", "ASC")
  .paginate();

🚦 Limits

const response = await api.resource("users").paginate({ page: 1, perPage: 25 });

⏩ First

const response = await api.resource("users").first();

❓ Where Conditions

const response = await api.resource("users").where("age", 18).paginate();
const response = await api
  .resource("users")
  .where("age", ">=", 18)
  .where("name", "Karl")
  .paginate();
const response = await api
  .resource("users")
  .where("age", ">=", 18)
  .orWhere("name", "Karl")
  .paginate();
const response = await api
  .resource("users")
  .where("age", ">=", 18)
  .andWhere("name", "Karl")
  .paginate();
const response = await api
  .resource("users")
  .where((query) => {
    query.where("name", "Karl").where("surname", "Popper");
  })
  .orWhere("age", ">=", 18)
  .paginate();
const response = await api
  .resource("users")
  .where("age", "IN", [18, 19, 20])
  .paginate();

All the operators should be able to used.

🔗 Related Data

const response = await api
  .resource("users")
  .with("posts{comments{id|content}}")
  .paginate();

⚡ Quick where functions

We can use the following query where functions:

  • whereNot("id", 1)
  • whereLike("name", "*john*")
  • whereNotLike("name", "*john*")
  • whereIn("type", [1, 2, 3])
  • whereNotIn("type", [1, 2, 3])
  • whereBetween("type", 1, 3)
  • whereNotBetween("type", 1, 3)
  • whereNull("age")
  • whereNotNull("age")

👥 Contributors

Made with contrib.rocks.

📜 License

MIT License