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

aneio

v1.0.2

Published

A Simple HTTP Client Library

Downloads

5

Readme

Aneio - A Simple HTTP Client Library

Aneio is a lightweight HTTP client built on Node.js core http and https modules. It provides a simple interface for making HTTP requests, similar to popular libraries like Axios, but without any external dependencies.

Features

  • Supports GET, POST, PUT, and DELETE requests
  • Automatically handles http and https protocols
  • Simple and lightweight (core Node.js modules only)

Installation

You can use this library by cloning the repository or copying the aneio folder to your project.

https://github.com/eranees/aneio.git

Alternatively, install the package directly using npm:

npm install aneio

Usage

Initialization

Important: Add "type": "module" in package.json

To use the library with ES Modules, ensure your package.json includes:

To start using Aneio, you need to create an instance of the client with an optional base URL.

{
  "type": "module"
}

Initialization

To start using Aneio, you need to create an instance of the client with an optional base URL.

import { Aneio } from "aneio";

const client = new Aneio("https://jsonplaceholder.typicode.com");

Example: Making a GET Request

GET Request

client
	.get("/posts/1")
	.then((response) => {
		console.log("GET Response:", response);
	})
	.catch((error) => {
		console.error("Error:", error);
	});

POST Request

client
	.post("/posts", { title: "foo", body: "bar", userId: 1 })
	.then((response) => {
		console.log("POST Response:", response);
	})
	.catch((error) => {
		console.error("Error:", error);
	});

PUT Request

client
	.put("/posts/1", { id: 1, title: "foo", body: "bar", userId: 1 })
	.then((response) => {
		console.log("PUT Response:", response);
	})
	.catch((error) => {
		console.error("Error:", error);
	});

DELETE Request

client
	.delete("/posts/1")
	.then((response) => {
		console.log("DELETE Response:", response);
	})
	.catch((error) => {
		console.error("Error:", error);
	});

Options

You can pass additional options like headers and query parameters.

client
	.get("/posts/1", {
		headers: {
			Authorization: "Bearer token123",
		},
	})
	.then((response) => {
		console.log("GET with headers:", response);
	})
	.catch((error) => {
		console.error("Error:", error);
	});

API

new Aneio(baseURL)

baseURL (optional): The base URL for all requests (e.g., https://api.example.com).

client.get(path, options)

  path: The API endpoint (e.g., /users).
  options (optional): An object containing request options like headers.

client.post(path, body, options)

path: The API endpoint (e.g., /users).
body: The request body (must be JSON serializable).
options (optional): An object containing request options like headers.

client.put(path, body, options)

path: The API endpoint (e.g., /users/1).
body: The request body (must be JSON serializable).
options (optional): An object containing request options like headers.

client.delete(path, options)

path: The API endpoint (e.g., /users/1).
options (optional): An object containing request options like headers.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

Author

Anees Akbar From Kashmir