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 🙏

© 2026 – Pkg Stats / Ryan Hefner

huo-request

v1.0.6

Published

huo

Downloads

36

Readme

一个集成小程序,uniapp,web axios 的接口请求集成

关于

此项目是小程序,uniapp,web 通用的请求解决集成方案,小程序和 uniapp 都是使用官方的 api 进行封装的。web 端是使用 axios 进行封装的。此集成方案主要是方便使用同一套配置方案,去使用不同平台的请求方案。因为每次都在不同平台用不同配置,有点太麻烦了

注:目前仅有微信端的封装,等有空再把 uniapp 和 web 端写好吧

说明

主要是方便自己使用啦,随便写来自己用来搬砖方便的 ^_^

自己代码写得烂,我懂 ^_^

给自己好好加油吧 👍

技术栈

官方小程序 api,uniapp 的 api,axios,typescript

项目运行

// 引用
import { WxRequest } from 'huo-request'

const { request }=new WxRequest({
     timeout: 6000, // 超时时间
    baseURL: 'http://localhost:3000',
    headers: {}, // 请求头
    withCredentials: false, //表示跨域请求时是否需要使用凭证
    //   responseType: "json", // 服务器响应的数据类型,可以是 'arraybuffer', 'blob', 'document', 'json', 'text', 'stream',默认json
    success: () => {}, //全局接口请求成功后
    fail: () => {
        new Map([
            [401, () => {}], //端口号报401
            [403, () => {}],
            [503, () => {}],
            [504, () => {}],
            [-1, () => {}],//没有指定端口号,默认报错执行-1
        ])
    }, // 全局接口请求失败后,statusCode非200的错误
    businessFail: () => {}, //statusCode为200,但code值不对的业务错误
    complete: () => {}, // 全局接口成功返回数据,无论失败或者成功
})

// 参数可以参考小程序we.request,uniapp的uni.request
export function myRequest(data) {
  return request({
    url: '/distribution/base/getCity', // 后端地址
    method: 'GET', // 请求方式
    data, // 参数
  })
}

功能列表

  • [x] 小程序 -- 完成
  • [x] uniapp -- 未完成
  • [x] web -- 未完成