Socket
Book a DemoInstallSign in
Socket

cohttp

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cohttp

node request & server module

1.0.6
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

cohttp

安装

npm -g i cohttp

完全使用 node.js 原生接口实现,不需要安装额外依赖。

静态服务器

此模块也可以作为静态文件的 http server 使用:

Usage: cohttp [-p port] [path]

可以通过 -p / --port 参数指定监听端口,默认为 5261 path 设置 webroot 目录,默认为当前所在目录

Node HTTP Request 库

提供一个 HTTP Request 库,支持 HTTP/HTTPS

Example

const URL = 'https://www.baidu.com';

request.get(URL).then(res => {
    console.log(res.data);
});

Node HTTP Server 库

提供一个 HTTP Server 库

Example

const server = new Server();

server.get(/^\/hello/, ({req, res}) => {
    res.body = 'Hello World';
})

server.listen(3000);

Keywords

http

FAQs

Package last updated on 21 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.