New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More →

jsonapi-server

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonapi-server - npm Package Compare versions

Comparing version

to
1.0.4

@@ -69,1 +69,3 @@ 2015-06-29 - Initial release

2015-12-17 - v1.0.3
2015-12-30 - Enable path-less API
2015-12-30 - v1.0.4
### Configuring jsonapi-server
```
```javascript
jsonApi.setConfig({

@@ -24,3 +24,3 @@ // HTTP / HTTPS

```
```javascript
jsonApi.onUncaughtException(function(request, error) {

@@ -33,3 +33,3 @@ // log the error somewhere

```
```javascript
// This function will be invoked on every request, as soon as the HTTP

@@ -50,3 +50,3 @@ // request has been parsed into a "request" object.

```
```javascript
jsonApi.start();

@@ -57,4 +57,4 @@ ```

```
```javascript
jsonApi.close();
```

@@ -118,3 +118,3 @@ "use strict";

urlParts.shift();
urlParts = urlParts.join("").split("?");
urlParts = urlParts.join(jsonApi._apiConfig.base).split("?");

@@ -121,0 +121,0 @@ var headersToRemove = [

{
"name": "jsonapi-server",
"version": "1.0.3",
"version": "1.0.4",
"description": "A fully featured NodeJS sever implementation of json:api. You provide the resources, we provide the api.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -10,4 +10,38 @@ [![Coverage Status](https://coveralls.io/repos/holidayextras/jsonapi-server/badge.svg?branch=master)](https://coveralls.io/r/holidayextras/jsonapi-server?branch=master)

`jsonapi-server` is a fully featured NodeJS server implementation of `json:api`. You provide the resources, we provide the api.
A config driven NodeJS framework implementing [`json:api`](http://jsonapi.org/). You define the resources, it provides the api.
### Motivation / Justification / Rationale
This framework solves the challenge of json:api without coupling us to any one ORM solution. Every other module out there is either tightly coupled to a database implementation, tracking an old version of the json:api spec, or is merely a helper library for a small feature. If you're building an API and your use case only involves reading and writing to a data store... well count yourself lucky. For everyone else, this framework provides the flexibility to provide a complex API without wasting developer time focusing on anything other than shipping valuable features.
A config driven approach to building an API enables:
* Enforced json:api responses
* Request validation
* Payload validation
* Automatic documentation generation
* Automatic inclusions
* Automatic routing
* Automatic handling of relationships
Ultimately, the only things you as a user of this framework need to care about are:
* What are my resources called
* What properties do my resources have
* For each resource, implement a `handler` for:
* `create`ing a resource
* `delete`ing a resource
* `search`ing for many resources
* `find`ing a specific resource
* `update`ing a specific resource
We've created `handler`s to automatically map our config over to database solutions help people get off the ground:
* [jsonapi-store-memoryhandler](https://github.com/holidayextras/jsonapi-server/blob/master/lib/MemoryHandler.js) - an in-memory data store to enable rapid prototyping. This ships as a part of `jsonapi-server` and powers the core test suite.
* [jsonapi-store-relationaldb](https://github.com/holidayextras/jsonapi-store-relationaldb) - using `sequelize` to support PostgreSQL, MySQL, MSSQL, MariaDB and SQLite.
* [jsonapi-store-mongodb](https://github.com/holidayextras/jsonapi-store-mongodb) - for MongoDB.
* [jsonapi-store-elasticsearch](https://github.com/holidayextras/jsonapi-store-elasticsearch) - *WIP* for Elasticsearch.
* [jsonapi-store-dynamodb](https://github.com/holidayextras/jsonapi-server/compare/dynamodb?expand=1) - *!SIGNIFICANT WIP!* for AWS DynamoDB.
We've also written a library to ease the consumption of a json:api compliant service:
* [jsonapi-client](https://github.com/holidayextras/jsonapi-client) - for NodeJS and Browsers
### Full documentation

@@ -20,3 +54,3 @@

- [Foreign Key Relations](documentation/foreign-relations.md)
- [Creating Handlers](documentation/handlers.md)
- [Custom Handlers](documentation/handlers.md)
- [Post Processing Examples](documentation/post-processing.md)

@@ -50,9 +84,9 @@

### Show me an full example!
### Show me a full example!
Fire up an example `json:api` server using the resources mentioned in the official spec via:
```
git clone https://github.com/holidayextras/jsonapi-server.git
npm install
npm start
$ git clone https://github.com/holidayextras/jsonapi-server.git
$ npm install
$ npm start
```

@@ -59,0 +93,0 @@ then browse to