restify Node.js的RESTful web框架

restify简介

restify,JavaScript的web框架,利用连接式中间件构建Node.js REST API,优化了内省和性能,可以用于进行大体量的生产使用。

restify应用实例

//服务器端构建
var restify = require('restify');

const server = restify.createServer({
  name: 'myapp',
  version: '1.0.0'
});

server.use(restify.plugins.acceptParser(server.acceptable));
server.use(restify.plugins.queryParser());
server.use(restify.plugins.bodyParser());

server.get('/echo/:name', function (req, res, next) {
  res.send(req.params);
  return next();
});

server.listen(8080, function () {
  console.log('%s listening at %s', server.name, server.url);
});

restify Github统计数据

MIT license

Github 10.7k stars

restify安装

Restify currently works on Node.js v14.x and v16.x,因此如果需要安装Node.js的,可以参考:Node.js的安装,及环境变量配置

restify安装命令:

npm install restify

restify文档

Documentation:restify

免责声明:内容编辑自网络,仅供参考,不保证正确性,不作任何决策依据!!以上数据皆截止于博文的写稿日期。


行业导航 / JavaScript指南 :


Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.