Fortune.js 超媒体 API 原型框架开源项目

我要开发同款
匿名用户2013年12月18日
159阅读

技术信息

开源地址
https://github.com/androidzhaoxiaogang/rocket
授权协议
MIT

作品详情

fortue是一个超媒体API原型框架,实现JSONAPI规范。fortue具有一个模块化的持久层,里面包括了NeDB(内联),MogoDB,MySQL,Postgres和SQLite的适配器,可以查看引导手册了解如何使用。

Fortue实现了所有JSONAPI的规范,还有一些其他的特性:

使用简单,Fortue提供免费的路线控制和数据库交互,不需要用户制作管道。

关联和双向关系的映射,不需要用户管理资源之间的关联关系。

在编辑前或者阅览之后,自动变换资源,实现特定的应用逻辑

fortue没有相关的授权和身份验证,你可以在你的应用中实现,可以查看样板:keystore.js。

用pm安装: 

$ pm istall fortue

示例代码:

import fortue from 'fortue'import http from 'http'cost store = fortue.create()// The `et.http` fuctio returs a listeer fuctio which does cotet// egotiatio, parses headers, ad maps the respose to a HTTP respose.cost server = http.createServer(fortue.et.http(store))store.defieType('user', {  ame: { type: Strig },  // Followig ad followers are iversely related (may-to-may).  followig: { lik: 'user', iverse: 'followers', isArray: true },  followers: { lik: 'user', iverse: 'followig', isArray: true },  // May-to-oe relatioship of user posts to post author.  posts: { lik: 'post', iverse: 'author', isArray: true }})store.defieType('post', {  message: { type: Strig },  // Oe-to-may relatioship of post author to user posts.  author: { lik: 'user', iverse: 'posts' }})store.coect().the(() => server.liste(1337))

功能介绍

fortune 是一个超媒体 API 原型框架,实现 JSON API 规范。fortune 具有一个模块化的持久层,里面包括了 NeDB (内联), MongoDB, MySQL, Postg...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论