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

@swzj/mock

v0.1.3

Published

快速开启 mock api 服务器

Downloads

3

Readme

@swzj/mock 随启随用的 mock api 服务器

随时随地将你的当前目录变成一个 mock api 服务器的根目录。

安装及使用

通过 npm -g 将其安装为命令行工具。

npm install @swzj/mock -g
// 启动服务(8000 为默认端口,当前文件夹为根目录)
$ s-mock
// 开启 mock api 服务
$ s-mock -m
// 设置服务端口
$ s-mock -p 8000
// 静默方式启动(不自动打开浏览器)
$ s-mock -s
// 设置主机名
$ s-mock -h localhost -p 8888
// 设置根目录
$ s-mock -d ./mock
// 启用 html5 history 路由模式
$ s-mock -f /index.html
// 开启服务代理
$ s-mock -x/--proxy http://localhost:7000/api
// 根据接口路径创建文件夹及 json 文件
$ s-mock -c/--create /test/user

若根目录下有文件:'test/user.json',user.json 则为请求 '/test/user' 提供数据源。
此时以任何请求方式请求 'http://x.x.x.x:8000/test/user' 都将得到 user.json 文件数据作为响应。

帮助

$ s-mock --help
Usage:
  s-mock --help // 打印帮助信息
  s-mock // 8000 为默认端口,当前文件夹为根目录
  s-mock 8888 // 将 8888 作为服务端口
  s-mock -m // 开启 mock api 服务
  s-mock -p 8989 // 将 8989 作为服务端口
  s-mock -s // 不自动打开浏览器(静默服务)
  s-mock -h localhost // 设置 localhost 为主机名
  s-mock -d /home // 将 /home 作为根目录
  s-mock -l // 打印日志
  s-mock -f /index.html // 启用 html5 history 路由模式,404 时回退到 /index.html
  s-mock -x/--proxy http://localhost:7000/api // 支持网址, webpack.config.js 或自定义配置文件
  s-mock -c/--create /test/user // 根据接口路径创建文件夹及 json 文件'

Fork

anywhere 功能增强