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 🙏

© 2025 – Pkg Stats / Ryan Hefner

soon-serve

v0.0.5

Published

一个轻量级的本地开发服务器工具,用于快速启动静态资源服务或代理后端接口,适用于前端开发调试场景。

Readme

soon-serve

一个轻量级的本地开发服务器工具,用于快速启动静态资源服务或代理后端接口,适用于前端开发调试场景。

功能特点

  • 🚀 快速启动本地 HTTP 服务器
  • 📁 支持静态文件托管
  • 🔗 内置 CORS 支持,解决跨域问题
  • ⚙️ 命令行参数自定义配置(端口、路径等)
  • 🔁 API 代理功能,支持路径重写
  • 🌐 自动打开浏览器
  • 📦 零依赖,纯 Node.js 实现

使用方法

基础使用

# 在当前目录启动服务
soon-serve

# 指定目录启动服务
soon-serve -s ./public

# 指定端口启动服务
soon-serve -p 3000

# 启动服务并自动打开浏览器
soon-serve -o

命令行参数

| 参数 | 全称 | 描述 | 示例 | |------|------|------|------| | -p | --port | 指定端口号(末尾加 f 可禁用自动递增) | -p 3000-p 3000f | | -s | --serve | 指定服务目录 | -s ./dist | | -r | --rewrites | 配置代理规则 | -r /api->http://localhost:8080 | | -b | --base | 设置基础路径 | -b /app | | -o | --open | 自动打开浏览器(可指定路径) | -o-o /admin |

代理规则详解

soon-serve 支持强大的 API 代理功能,可以解决开发过程中的跨域问题。以下是几种常见的代理规则配置方式:

1. 基础代理

将特定路径的所有请求代理到目标服务器:

# 将 /api 开头的所有请求代理到 http://localhost:8080
soon-serve -r /api->http://localhost:8080/api

# 示例:
# /api/users -> http://localhost:8080/api/users
# /api/products/123 -> http://localhost:8080/api/products/123

2. 多路径代理到同一目标

将多个路径前缀的请求代理到同一个目标服务器:

# 将 /api 和 /upload 的请求都代理到 http://localhost:8080
soon-serve -r /api,/upload->http://localhost:8080

# 或者使用多个 -r 参数
soon-serve -r /api->http://localhost:8080/api -r /upload->http://localhost:8080/upload

3. 多个独立代理规则

配置多个不同的代理规则:

# 分别配置不同路径的代理规则
soon-serve -r /api->http://localhost:8080 -r /upload->http://localhost:9000

# 示例:
# /api/users -> http://localhost:8080/users
# /upload/image.png -> http://localhost:9000/image.png