Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhike-team/express-metadata
注册express中routes, dependencies, version以及项目和开发人员信息
https://github.com/zhike-team/express-metadata
Last synced: 4 days ago
JSON representation
注册express中routes, dependencies, version以及项目和开发人员信息
- Host: GitHub
- URL: https://github.com/zhike-team/express-metadata
- Owner: zhike-team
- Created: 2016-07-13T04:10:02.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-07-26T03:57:42.000Z (over 5 years ago)
- Last Synced: 2025-01-01T09:18:53.877Z (25 days ago)
- Language: JavaScript
- Size: 936 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Express 元数据收集插件
=========================### [English read me](./english.readme.md)
### 有哪些功能?
1. 注册项目中的路由
2. 注册改项目的作者, 版本以及依赖### 通过这个可以干什么?
服务化后收集本项目相关的元数据信息(metadata)来注册到配置中心来给其他的服务调用.### 参数?
metadata(router, prefix | option);### 如何使用?
```javascript
const express = require('express');
const metadata = require('express-metadata');
const app = metadata(express())app.get('/awesome-uri', foo)
app.post('/awesome-uri-2', 'createUser' foo2)
.
.
.
console.log(app.metadata())
{
routersSetting:
[
{ name: '', method: 'get', url: '/awesome-uri' },
{ name: 'createUser', method: 'post', url: '/awesome-uri-2' }
],
projectInfo:
{
name: '',
version: '',
author: '',
dependencies: ''
}
}```
**或者**
```javascript
const metadata = require('express-metadata');
const router = metadata(express.Router());router.get('/xx', foo)
.
.
.```