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

horange

v0.0.18

Published

horange.js

Downloads

33

Readme

node-server

1.npm install

2.npm run webpack

3.npm run dev

4.http://localhost:3033/api/test

接口定义遵循Restful风格规范,其中:

1 GET 获取,幂等,请求指定页面信息,并返回实体主体

2 HEAD 类似于GET请求,只不过返回的响应中没有具体的内容,用于获取报头

3 POST 新增,非幂等,向指定资源提交数据进行处理请求(例如提交表单或者上传文件)。POST请求可能会导致新的资源的建立和/或已有资源的修改。

4 PUT 修改,幂等,多次执行后资源不变,从客户端向服务器传送的数据取代指定的文档的内容。(全部取代)

5 PATCH 修订,非幂等,每次执行后资源可能改变,从客户端向服务器传送的数据取代指定的文档的内容。(部分取代)

6 DELETE 删除,幂等,请求服务器删除指定的页面。

7 CONNECT HTTP/1.1协议中预留给能够将连接改为管道方式的代理服务器。

8 OPTIONS 允许客户端查看服务器的性能。

9 TRACE 回显服务器收到的请求,主要用于测试或诊断。

如 GET /api/test?filter[name]=nnn&filter[number]=bbbb&isCount=true&pageSize=20&page=1&order= id DESC 表示获取列表数据

GET /api/test?id=aaaasfsdfsdf 表示获取详情数据

POST /api/test 表示新增数据

PUT /api/test 表示编辑数据

DELETE /api/test?id=sdfdsgdg 表示删除数据

api-xxx.js:书写规范:

1.文件采用数据库表名或模块名api-xxx.js命名

2.方法名采用驼峰法命名,以请求方式开头,如 get post put delete

3.如果函数中需要使用async await的,需要增加async await关键字声明

4.使用Tool.checkParam(request,[[]]),获取参数值并对参数进行校验

5.使用Tool.returnError(response,msg,400),返回错误信息

6.使用Tool.returnData(response,res),返回接口数据

7.使用try{} catch (err){}包裹代码主题部分,以获取程序异常信息

8.对于复杂或者可复用的逻辑代码处理部分,可将相应的逻辑抽离到xxx-service.js中