High-level I/O for web applications.
Fortune is a high-level I/O library for web applications. It provides an implementation of entity-relationship modelling, is agnostic about data storage, and can be used to power real-time (WebSocket) and hypermedia applications (RMM Level 3).
View the website for documentation. Get it from
$ npm install fortune --save
Let's build an API that models Twitter's basic functionality:
import fortune from 'fortune'import http from 'http'const store = fortunecreate// The `net.http` function returns a listener function which does content// negotiation, parses headers, and maps the response to an HTTP response.const server = httpcreateServerfortunenethttpstorestoredefineType'user'name: type: String// Following and followers are inversely related (many-to-many).following: link: 'user' inverse: 'followers' isArray: truefollowers: link: 'user' inverse: 'following' isArray: true// Many-to-one relationship of user posts to post author.posts: link: 'post' inverse: 'author' isArray: truestoredefineType'post'message: type: String// One-to-many relationship of post author to user posts.author: link: 'user' inverse: 'posts'storeconnectthen => serverlisten1337
See the plugins page for more details.
This software is licensed under the MIT license.