Intro
简单,无依赖的http服务器
Simple, no-dependence http server.
Installation
npm快速安装
Easiest way is npm.
npm install httpsvr
Usage
const http = ; /** * http://localhost:8080/api/login => req.$action => 'login' * http://localhost:8080/api/query => req.$action => 'query' * * http://localhost:8080/api/query?id=123&page=2 * req.$ => {id: '123', page: '2'} instanceof URLSearchParams * req.$action => 'query' */http; /** * http://localhost:8080/api/upload * GET /api/upload => 405 Method Not Allowed */http; /** * http://localhost:8080/admin/info/login * req.$user => 'admin' * req.$action => 'login' * * http://localhost:8080/alice/info/logout * req.$user => 'alice' * req.$action => 'logout' */http; /** * Started HTTP server on port 8080 * http://localhost:8080 * wwwroot => __dirname */http;