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

yao-node-server

v1.0.8

Published

A node proxy server for yao application development

Downloads

8

Readme

功能

此 api 服务器主要目的是用来测试 yao js 脚本。方便测试编写 ts 脚本功能。

使用 express 搭建的 api 测试服务器,服务器在启动时,路由路径的配置从 yao 应用的 apis 目录下读取.

在.env 文件中配置变量 YAO_APP_ROOT 来指定 YAO 应用目录

支持 api 配置文件中使用以下参数获取数据

  • 支持$query,$form,$payload

  • 支持:query-param,:params,转换成 sql 查询参数比较复杂

  • 文件上传,需要使用 multipart/form-data 的方式上传。使用的插件是 express-fileupload。api 配置文件使用$file.name 的方式获取。 html 上需要使用<input name="foo" type="file" />。postname 需要使用 multipart/form-data 的方式上传,而不是 raw 的方式。

  • 支持 api 配置文件中返回使用 bind 的语法。

  • 不支持$session

环境搭建

pnpm i express dotenv
pnpm i -D @types/express
pnpm i -D typescript @types/node
pnpm i express-fileupload

调试

如果需要调试 express 的路由,需要配置环境变量 DEBUG

DEBUG=express:*

拦截 api

使用覆盖 api 定义的方式拦截 api 请求,调用本地的脚本,可以在本地作调试

复制远程 api 定义到本地目录,配置环境变量 LOCAL_API_FOLDER,默认目录是 src/app.相同的配置名本地会覆盖远程。启动 express 应用后可以拦截请求。

拦截前端应用

配置环境 YAO_APP_ROOT 指向 YAO 应用根目录,可以使用远程应用的 public 目录。在本地就可以使用本地地址直接访问前端应用资源。

调试

使用了 nodemon,配置文件 nodemon.json,可以同时监控开发目录与 apis 目录

pnpm run dev:node