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

@thatcompany/axios

v1.1.1

Published

像Spring一样编写前端请求。Like edit Spring Controller, edit TypeScript class for Axios

Downloads

27

Readme

Introduction 介绍

Like edit Spring Controller, edit TypeScript class for Axios.

像编辑 Spring Controller 一样编辑 Axios 的 TypeScript 类

Docs 文档

For China:钟意博客

For Other:Thanks for Vercel

Repository 仓库

欢迎大家 Star、Fork、提 Issues。

Welcome to Star、Fork、Report Issues.

GitHub:axios-enhancer

Demo 效果

Restful API Support

这个demo展示了如何使用 Axios-Enhancer 生成 基础的 CRUD 接口。拥有 findById、findAll、save、update、delete 等方法。

This demo shows how to use Axios-Enhancer to generate basic CRUD interfaces. It has findById, findAll, save, update, and delete methods.

import Shop from "@/types/ShopCard";
import { RequestMapping, RestFulMapper } from "@thatcompany/axios";

@RequestMapping('/proxy/service/know/shop')
export class ShopMapper extends RestFulMapper<Shop, number> {}

export default new ShopMapper();

Request Decorator

这个demo展示了如何使用 Axios-Enhancer 进行请求装饰器。

This demo shows how to use Axios-Enhancer for request decorators.

import { RequestMapping, GetMapping, PostMapping, DeleteMapping, PutMapping } from "@thatcompany/axios";

@RequestMapping("/proxy/service/know/order")
class OrderMapper{

    // 可定义返回类型辅助ts
    // You can define the return type to help ts
    @GetMapping("/list")
    async getOrders(order: Order): Promise<ThatAxiosResponse> {
        return Promise.resolve({} as ThatAxiosResponse);
    }

    // 也可以不定义返回类型返回 Promise<any>
    // You can also return Promise<any> without defining the return type
    // {orderId} 会填充为orderId参数
    // {orderId} will be filled with orderId parameter
    @GetMapping("/{orderId}")
    async getOrderById(orderId: Number) {}

    // {payNo} 会填充为payNo参数
    // {payNo} will be filled with payNo parameter
    // orderId和payNo参数会被构建为data和params
    // orderId and payNo parameters will be built as data and params
    // GET DELETE => /permit/{payNo}?orderId={orderId}&payNo={payNo}
    @GetMapping("/permit/{payNo}")
    @RequestLog  // 日志记录 // Log recording
    @RequestSecurityPermit // 安全放行  // Security Permit
    async getOrderByPayNo(payNo: string, orderId: Number) {}

    // 单个对象参数,会被解构为data和params
    // Single object parameter will be destructured as data and params
    @PostMapping("/permit")
    @RequestSecurityPermit // 安全放行
    async createOrder(orderThesis: OrderThesis) {}
}

export default new OrderMapper();