New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mini-daemon

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mini-daemon

![build status](https://travis-ci.org/tianmajs/tianma-mount.svg?branch=master)

  • 1.0.0-b0
  • beta
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

tianma-mount

build status

在给定域名或路径上使用中间件。

安装

$ npm install tianma-mount

使用

挂载域名

tianma()
	.mount('localhost').then
		.use(middleware)
		.end
	.mount('www.example.com').then
		.use(middleware)
		.end
	.mount('example.com').then
		.use(middleware)
		.end
		

挂载路径

tianma()
	.mount('/foo').then
		.use(middleware)
		.end
	.mount('/bar/baz').then
		.use(middleware)
		.end
	.mount('/').then
		.use(middleware)
		.end
		

挂载域名加路径

tianma()
	.mount('localhost').then
		.mount('/foo').then
			.use(middleware)
			.end
		.mount('/bar').then
			.use(middleware)
			.end
		.end
	.mount('example.com/foo').then
		.use(middleware)
		.end
	.mount('example.com/bar').then
		.use(middleware)
		.end
		

路径切除

请求路径与挂载路径匹配时,request.pathname中的挂载部分会被切除,切除掉的部分可通过request.base访问。

tianma()
	.use(function *(next) {
		this.request.url('/foo/bar');
	})
	.mount('/foo').then
		.use(function *(next) {
			this.request.base; // => "/foo"
			this.request.pathname; // => "/bar"
		})
		.end

授权协议

MIT

Keywords

FAQs

Package last updated on 12 Mar 2015

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc