# maki-sushi

> Neo4j REST API wrapper

Latest version **1.0.5** (published 2016-12-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install maki-sushi
pnpm add maki-sushi
yarn add maki-sushi
bun add maki-sushi
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2016-12-08 |
| First published | 2016-01-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Jo Colina |
| Maintainers | jsmrcaga |
| Keywords | neo4j, graph, database, wrapper, sushi, maki, maki-sushi, databases, neo, 4j |

## Links

- npm: https://www.npmjs.com/package/maki-sushi
- npm.io page: https://npm.io/package/maki-sushi

## Dependencies (1)

- [http](https://npm.io/package/http.md) *

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2016-12-08
- 0.3.5 — 2016-06-14
- 0.3.0 — 2016-06-14
- 0.2.0 — 2016-06-14
- 0.1.0 — 2016-06-14
- 0.0.4 — 2016-01-19
- 0.0.3 — 2016-01-18
- 0.0.2 — 2016-01-18
- 0.0.1 — 2016-01-18

## README

#Maki-Sushi

##Intro
Maki-Sushi is a Neo4J REST API wrapper (hence the name), which allows you to call the API in simple, comprehensible code.

It was developped by Jo Colina [@jsmrcaga](http://twitter.com/jsmrcaga) to use with Graphr, a simple graph viewer.

##Installation
You can install maki-sushi globally or locally like so:

Locally:

`npm install maki-sushi`

Global:

`npm install maki-sushi -g`

##Usage
```javascript
var maki = require('maki-sushi');
```
We will be using `maki` in the rest of the documentation to reference an instance of maki-sushi.

###Config
Different methods allow you to configure Maki-Sushi, however, most of them are used by maki-sushi internal functions, which you can use to simplify your code.
You can use these configuration functions if you need to make custom requests to your Neo4j server.

####setEndpoint(host, path)
This function overrides the default host: `localhost` and path `/db/data`. 
Only to use if you have configured your Neo4J server to listen in a different endpoint.

####setPort(port)
This function overrides the default port `7474`. Only to use if you have configured your Neo4J server to listen on a different port.

####setId(user, password)
This function sets your IDs in need of authentication. 
In Neo4J auth is treated with a simple HTTP header in base 64

####setPath(path)
This function appends the path to the base path endpoint. Eg: `setPath("/transaction")` returns `"/db/data/transaction"`

####setMethod(method)
Sets the HTTP method to use in query: GET, POST, DELETE, PUT.

####setHeaders(headers)
Set headers to send with request. Must be defined as JSON:
```javascript
{
	"Content-Type": "application/json",
	"headerX" : "valueX"
}
```

###Callbacks
Every function called by maki requires a callback. Each callback is given the status code of the response (as Neo4J uses very different statuses for responses) and the corresponding response in a JSON string.

Your callbacks must then be as follows:

```javascript
function(status, response){
	if(status > 400){
		// typically error
		return;
	}

	treat(response);
}
```

###Nodes
Simple node manipulations functions.
####create(properties, callback)
This method, called as: `maki.nodes.create(properties, callback)` creates a node in Neo4J with the given properties. Properties are sent as a javascript Object Literal. EG:
```javascript
maki.nodes.create({
	name: 'MyNodeName'
}, function(st, res){
	// do something
});
```

---
_Source: https://npm.io/package/maki-sushi · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
