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

songc-http-utils

v1.0.0

Published

需先安装 **node** 环境,才能启动程序。

Downloads

2

Readme

原生node封装的一个简单http请求框架

运行环境

需先安装 node 环境,才能启动程序。

启动服务

## 下载依赖
npm install
## 启动服务
node app.js

端口配置

app.js 中设置端口

数据库配置

utils/connectMysql.js 中进行数据库的相关配置

请求路径与文件的关系

每一个请求都对应一个文件

如果登录接口的请求的路径是 /user/login ?name=xiaMin&pwd=123

那么对应的响应的文件就是 根目录下的 /user/login.js

所以我们的登录接口的代码就写在 /user/login.js 中。

一个文件夹下可以有多个文件,随你自己怎么存放文件,记着请求的路径就是文件路径就行

监听请求

utils/listen.js

这个文件是用来监听请求的文件,这是一个比较重要的文件。看得懂最好,看不懂也没关系。

主要就是处理了

  • 获取get参数

  • 获取post数据

  • 请求路径余文件的关系。

请求示例

普通请求

返回前端一个 json 对象的请求。

查看示例: user/login.js

静态资源请求

请求一个服务器中的静态资源,并不是下载。比如:头像文件存放在服务器中,我们显示头像并不需要下载下来显示。

查看示例:static/index.js

上传文件

获取前端上传的文件,存放在服务器中。

查看示例:uploadFile/index.js

下载文件

前端下载服务器中的文件。

查看示例:downLoad/index.js