代码拉取完成,页面将自动刷新
Easy to build api server depend on express.
Easy to write, easy to test, easy to generate document.
$ npm install erest --save
$ npm install generator-erest -g
# Express
$ yo erest:express
# erest
$ yo erest:lei-web
'use strict';
const API = require('erest').default;
// API info for document
const INFO = {
title: 'erest-demo',
description: 'Easy to write, easy to test, easy to generate document.',
version: new Date(),
host: 'http://127.0.0.1:3000',
basePath: '/api',
};
// API group info
const GROUPS = {
Index: '首页',
};
// Init API
const apiService = new API({
info: INFO,
groups: GROUPS,
});
apiService.api.get('/index')
.group('Index')
.title('Test api')
.register((req, res) => {
res.end('Hello, API Framework Index');
});
const express = require('express');
const app = express();
const router = new express.Router();
app.use('/api', router);
// bing express router
apiService.bindRouter(router, apiService.checkerExpress);
app.listen(3000, function () {
console.log('erest-demo listening started');
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型