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

@appolo/http

v8.1.10

Published

appolo http module

Downloads

790

Readme

Http Service module for appolo build with axios

Installation

npm i @appolo/http

in config/modules/all.ts

Options

| key | Description | Type | Default | --- | --- | --- | --- | | id | httpService injection id | string| httpService|

any option from Request Config can be added and will be added to all request.

import {HttpModule} from '@appolo/http';

export = async function (app: App) {
   await app.module(new HttpModule({baseURL:"https://some-domain.com/api/",retry:2}));
}

Usage

import {define, singleton,inject} from 'appolo'
import {publisher} from "@appolo/http";

@define()
@singleton()
export class SomeManager {

    @inject httpService:HttpService

    async getUserId(): Promise<string> {

        let result = await this.httpService.request<{userId:string}>({
            url:"http://someurl"
            method:"post"
            timeout:1000
            retry:3
        })

        return result.data.userId
    }
}

Request Config

| key | Description | Type | Default |---------------------|-------------------------------------------------------------------------------| --- | --- | | url | request url | string| ``| | method | is the request method to be used when making the request |string|get| |baseURL |baseURLwill be prepended tourlunlessurlis absolute |string| `` | |headers | custom headers |object|{}| |params | are the URL parameters to be sent with the request |object|{}| |data | the data to be sent as the request body |object|{}| |timeout | specifies the number of milliseconds before the request times out |number|0| |withCredentials | indicates whether or not cross-site Access-Control requests |boolean|false| |auth | indicates that HTTP Basic auth should be used, and supplies credentials |object|{}| |authDigest | indicates that HTTP Digest Auth should be used, and supplies credentials |object|{}| |responseType | indicates the type of data that the server will respond with |string|json| |responseEncoding | indicates encoding to use for decoding responses |string|utf8| |maxRedirects | defines the maximum number of redirects to follow in node.js |number|5| |retry | retry times on requests that return a response (500, etc) before giving up |number|0| |noResponseRetries| etry times on errors that don't return a response (ENOTFOUND, ETIMEDOUT, etc) |number|0| |retryDelay | Milliseconds to delay at first |number|100` |