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

albi

v4.0.0

Published

backend framework base on koa

Downloads

10

Readme

albi

Web framework base on koa 2.x.

模块分类

  • controllers 主要是实现路由的相关处理函数,对于参数的校验,services的调用方,通过不同的service获取路由的响应结果

  • services 各业务相关的实现变,该组件主要实现与数据库的相关操作,以及其它依赖服务的调用实现等。

  • helpers 各类公共的组件,主要是与业务无关的各类功能实现

  • middlewares 各类常用的中间件,包括session, limit, error

  • models mongodbmodel相关定义

  • router 路由的调用链定义

  • errors 各种出错的定义

  • tasks 各类定时执行的任务

  • views 模板目录

  • influx-schemas influxdb的schema定义

常用Middlware

  • noQuery 要求url中无query参数,主要用于可缓存的请求,为了避免添加参数导致varnish缓存失效,因此如果无参数的可缓存路由处理,尽量添加此middleware

  • noCache 为了方便varnish判断请求是否可以缓存,对于GETHEAD请求,如果未设置Header Cache-Control:no-cache或者query string中无cache-control=no-cache,则以增加cache-control=no-cache,并以302的形式跳转

  • auth.admin 验证HTTP请求所带的Auth-Token是否admin,主要用于一些设置系统状态等路由使用

  • level 用于限制某此接口在系统level处于较低水平时,直接返回系统繁忙(http status 503)

  • version 指定该接口version版本

  • session.read 只读取session信息,不做任何的修改

  • session 正常的session处理,可以写数据到session

HTTP状态码

  • 对于所有的请求,如果是参数校验出错,状态码为400

  • 对于需要登录的请求,如果是未登录状态,状态码为401

  • 对于POST请求,正常处理时,状态码为201

License

MIT