npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fortune-agco

v0.2.9

Published

Web framework for prototyping hypermedia APIs.

Downloads

11

Readme

Fortune.js Build Status

Hello nerds. Fortune is a web framework for prototyping hypermedia APIs that implement the JSON API specification. It comes with a modular persistence layer, with adapters for NeDB (built-in), MongoDB, MySQL, Postgres, & SQLite.

Get it by installing from npm:

$ npm install fortune

Road to 1.0

There is a release tag for v1.0 of JSON API, though Fortune does not yet implement the entire feature set. What needs to be done:

  • Querying, pagination, sorting
  • Compound documents
  • Content negotiation between different formats (future, planned)
  • Ensuring specification compliance

Contributions welcome.

Features

Fortune implements everything you need to get started with JSON API, with a few extra features:

  • Batteries included, Fortune handles routing and database interactions so you don't have to.
  • Serializers and deserializers for JSON API, and other hypermedia formats (in the future).
  • Hooks to implement application specific logic before/after interacting with resources.

It does not come with any authentication or authorization, you should implement your own application-specific logic (see keystore.js for an example).

Guide & Documentation

The full guide and API documentation are located at fortunejs.com.

Basic Usage

Here is a minimal application:

var fortune = require('fortune');
var app = fortune();

app.resource('person', {
  name: String,
  age: Number,
  pets: ['pet'] // "has many" relationship to pets
});

app.resource('pet', {
  name: String,
  age: Number,
  owner: 'person' // "belongs to" relationship to a person
});

app.listen(1337);

This exposes a few routes for the person and pet resources, as defined by the JSON API specification:

| HTTP | Person | Pet | Notes | |--------|--------------------|-------------------|--------------------------------------------------------------| | GET | /people | /pets | Get a collection of resources, accepts query ?ids=1,2,3... | | POST | /people | /pets | Create a resource | | GET | /people/:id | /pets/:id | Get a specific resource, or multiple: 1,2,3 | | PUT | /people/:id | /pets/:id | Create or update a resource | | PATCH | /people/:id | /pets/:id | Patch a resource (see RFC 6902) | | DELETE | /people/:id | /pets/:id | Delete a resource | | GET | /people/:id/pets | /pets/:id/owner | Get a related resource (one level deep) |

Unit Testing

Tests are written with Mocha, and are run against the built-in NeDB adapter, plus MongoDB & MySQL on Travis. You will also need to have the developer dependencies installed. To run tests:

$ npm test

Client-side Implementations

Meta

For release history and roadmap, see CHANGELOG.md.

Fortune is licensed under the MIT license, see LICENSE.md.