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

aok.js

v2.4.1

Published

revert the koa

Downloads

24

Readme

aok.js

reverse the koa , ROP resource oriented program

phil(哲学)

phil

about version

v2.0.0

  1. add .aokignore just like .gitignore
  2. 默认忽略扫描node_modules/的文件
  3. ext 扩展功能,详见 ext 参考下面的csv.aok
  4. 支持csv扩展 csv.aok

just step by step to understand aok

npm i -g aok.js

mkdir temp
cd temp

cat << EOF > data.json
{
    "hello":"good good day"
}
EOF

aok . 

# try  visit by http
#GET : http://localhost:11540/data?node=hello
#POST : http://localhost:11540/data
#PUT : http://localhost:11540/data?node=
#DELETE : http://localhost:11540/data?node=

what is aok

  1. 暴露出去的资源方法,同时支持同步及异步方法

    {
        "@get" : (params , ctx , options) =>{
            // return {}
            // return []
            return Promise.resolve(1)
        },
        "@post" : async (params , ctx , options) =>{
            // return {}
            // return []
            return Promise.resolve(1)
        }
    }
  2. 也支持其他形式

    {
        "@delete" :  'test delete success',
        "@put" : {
            hello : 'good good day'
        }
    }
  3. 方法参数说明

    params : get时 ctx.query 其他methods 时 取 ctx.request.body

    ctx : 请求上下文

    options : 程序启动的options,应用直接获取做一些特殊处理

  4. 文件上传支持

    采用koa-body方式上传文件,ctx.request.files直接获取

use

cli

npm i -g aok.js

aok -h 

aok [yourDir] -s [yourStaticDir] -p [yourport]

amazing using

npm i -g lisa.dl

aok https://github.com/apporoad/aok.js/blob/master/example/example.zip?raw=true --type zip

# more in aok -h

aok https://github.com/apporoad/pnote.git --type git -r api -s static -w pnote -d

code

npm i --save aok.js
const aok = require('aok.js')

aok.mount('yourDirPath', 'yourStaticDirPath',{ port:11540})

how to debug

debug use debug

# LINUX
DEBUG=* aok xxx xxx

#windows powershell
$env:DEBUG = "*,-not_this"

how to deploy

npm i -g pm2
npm i -g aok.js

pm2 start --name yourApp aok -- . -p 11540

ps

we use '_any_' as '*' with your fileName

you can : 
_any_.js => /*
abc/_any_.js => /abc/*
// .json support  json node operations

you can :

GET http://localhost:11540/?node=abc.hello
PUT http://localhost:11540/?node=abc.hello
DELETE http://localhost:11540/?node=abc.hello

just try it

docker

jump

how to debug

推荐做法是直接采用本地引用,直接调用方式
一些情况必须启动aok,vscode 采用如下配置方式:

{
    "program": "/usr/local/bin/aok",
    "args": ["${workspaceFolder}/api" , "-p" ,"10000"]
}

examples

  1. pnote
  2. apinfo
  3. dmodule
  4. danmu.js
  5. adding