-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): move api to main nivo repo
- Loading branch information
Raphaël Benitte
authored and
Raphaël Benitte
committed
Nov 30, 2018
1 parent
07b1bad
commit 5024596
Showing
81 changed files
with
2,709 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) Raphaël Benitte | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: node src/app.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# nivo-api | ||
|
||
Rendering API for [nivo](https://github.com/plouc/nivo) dataviz React/d3 components. | ||
|
||
A [demo](https://nivo-api.herokuapp.com/) is available on heroku, but may not respond depending on usage. | ||
|
||
## How it works | ||
|
||
The API expose some of the [nivo](https://github.com/plouc/nivo) charts by using | ||
[React server side environment](https://facebook.github.io/react/docs/environments.html). | ||
|
||
First you will have to make a post request on the desired endpoint, for example: | ||
|
||
```sh | ||
curl -X POST \ | ||
--header 'Content-Type: application/json' \ | ||
--header 'Accept: application/json' \ | ||
-d '{ "width": 500, "height": 500, "data": [[223, 299, 345, 184], [123, 248, 65, 123], [412, 76, 187, 312], [97, 37, 502, 176]]}' \ | ||
'http://localhost:3030/charts/chord' | ||
|
||
{ | ||
"id": "73633fea-160e-4118-a534-377c3ed85254", | ||
"url": "http://localhost:3000/r/73633fea-160e-4118-a534-377c3ed85254" | ||
} | ||
``` | ||
|
||
The response contains a link to the chart | ||
|
||
``` | ||
GET http://localhost:3000/r/73633fea-160e-4118-a534-377c3ed85254 | ||
``` | ||
|
||
## Charts endpoints | ||
|
||
``` | ||
POST /charts/bar | ||
POST /charts/bubble | ||
POST /charts/calendar | ||
POST /charts/chord | ||
POST /charts/line | ||
POST /charts/pie | ||
POST /charts/radar | ||
POST /charts/sankey | ||
POST /charts/sunburst | ||
POST /charts/treemap | ||
``` | ||
|
||
## Charts samples | ||
|
||
- https://nivo-api.herokuapp.com/samples/line.svg | ||
- https://nivo-api.herokuapp.com/samples/bar.svg | ||
- https://nivo-api.herokuapp.com/samples/bubble.svg | ||
- https://nivo-api.herokuapp.com/samples/chord.svg | ||
- https://nivo-api.herokuapp.com/samples/pie.svg | ||
- https://nivo-api.herokuapp.com/samples/radar.svg | ||
- https://nivo-api.herokuapp.com/samples/sankey.svg | ||
- https://nivo-api.herokuapp.com/samples/sunburst.svg | ||
- https://nivo-api.herokuapp.com/samples/treemap.svg | ||
|
||
## Repositories | ||
|
||
- [nivo](https://github.com/plouc/nivo) - the nivo library | ||
- [nivo-api](https://github.com/plouc/nivo-api) - the nivo http api | ||
- [nivo-api-docker](https://github.com/plouc/nivo-api-docker) - a Docker image for the nivo http api | ||
- [nivo-generators](https://github.com/plouc/nivo-generators) - the data generators used for nivo-website and http API samples | ||
- [nivo-website](https://github.com/plouc/nivo-website) - the source for the nivo website |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# nivo-api | ||
|
||
Rendering API for [nivo](https://github.com/plouc/nivo) dataviz React/d3 components. | ||
|
||
A [demo](https://nivo-api.herokuapp.com/) is available on heroku, but may not respond depending on usage. | ||
|
||
## How it works | ||
|
||
The API expose some of the [nivo](https://github.com/plouc/nivo) charts by using | ||
[React server side environment](https://facebook.github.io/react/docs/environments.html). | ||
|
||
First you will have to make a post request on the desired endpoint, for example: | ||
|
||
```sh | ||
curl -X POST \ | ||
--header 'Content-Type: application/json' \ | ||
--header 'Accept: application/json' \ | ||
-d '{ "width": 500, "height": 500, "data": [[223, 299, 345, 184], [123, 248, 65, 123], [412, 76, 187, 312], [97, 37, 502, 176]]}' \ | ||
'http://localhost:3030/charts/chord' | ||
|
||
{ | ||
"id": "73633fea-160e-4118-a534-377c3ed85254", | ||
"url": "http://localhost:3000/r/73633fea-160e-4118-a534-377c3ed85254" | ||
} | ||
``` | ||
|
||
The response contains a link to the chart | ||
|
||
``` | ||
GET http://localhost:3000/r/73633fea-160e-4118-a534-377c3ed85254 | ||
``` | ||
|
||
## Charts endpoints | ||
|
||
``` | ||
{{#endpoints}} | ||
POST {{{.}}} | ||
{{/endpoints}} | ||
``` | ||
|
||
## Charts samples | ||
|
||
{{#samples}} | ||
- https://nivo-api.herokuapp.com/samples/{{{.}}}.svg | ||
{{/samples}} | ||
|
||
## Repositories | ||
|
||
- [nivo](https://github.com/plouc/nivo) - the nivo library | ||
- [nivo-api](https://github.com/plouc/nivo-api) - the nivo http api | ||
- [nivo-api-docker](https://github.com/plouc/nivo-api-docker) - a Docker image for the nivo http api | ||
- [nivo-generators](https://github.com/plouc/nivo-generators) - the data generators used for nivo-website and http API samples | ||
- [nivo-website](https://github.com/plouc/nivo-website) - the source for the nivo website |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* This file is part of the nivo project. | ||
* | ||
* (c) 2016 Raphaël Benitte | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
'use strict' | ||
|
||
const _ = require('lodash') | ||
const mapping = require('../src/mapping') | ||
const samples = require('../src/samples') | ||
|
||
const data = { | ||
endpoints: [], | ||
samples: [], | ||
} | ||
|
||
_.forOwn(mapping, (config, type) => { | ||
data.endpoints.push(`/charts/${type}`) | ||
}) | ||
|
||
_.forOwn(samples, (config, id) => { | ||
data.samples.push(id) | ||
}) | ||
|
||
console.log(JSON.stringify(data)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"name": "@nivo/api", | ||
"version": "0.51.6", | ||
"description": "Rendering API for nivo dataviz React/d3 components", | ||
"main": "src/app.js", | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://github.com/plouc/nivo/blob/master/LICENSE.md" | ||
} | ||
], | ||
"author": { | ||
"name": "Raphaël Benitte", | ||
"url": "https://github.com/plouc" | ||
}, | ||
"engineStrict": true, | ||
"engines": { | ||
"node": ">=6.0.0" | ||
}, | ||
"devDependencies": { | ||
"mustache": "^2.3.0", | ||
"nodemon": "^1.18.7" | ||
}, | ||
"dependencies": { | ||
"@nivo/bar": "0.51.6", | ||
"@nivo/bullet": "0.51.0", | ||
"@nivo/calendar": "0.51.0", | ||
"@nivo/chord": "0.51.2", | ||
"@nivo/circle-packing": "0.51.0", | ||
"@nivo/core": "0.51.0", | ||
"@nivo/generators": "0.51.0", | ||
"@nivo/heatmap": "0.51.0", | ||
"@nivo/legends": "0.51.0", | ||
"@nivo/line": "0.51.6", | ||
"@nivo/parallel-coordinates": "0.51.0", | ||
"@nivo/pie": "0.51.0", | ||
"@nivo/radar": "0.51.0", | ||
"@nivo/sankey": "0.51.0", | ||
"@nivo/scatterplot": "0.51.3", | ||
"@nivo/stream": "0.51.5", | ||
"@nivo/sunburst": "0.51.0", | ||
"@nivo/treemap": "0.51.0", | ||
"@nivo/voronoi": "0.51.0", | ||
"@nivo/waffle": "0.51.0", | ||
"body-parser": "^1.17.2", | ||
"compression": "^1.7.0", | ||
"cors": "^2.8.4", | ||
"express": "^4.15.4", | ||
"express-winston": "^2.4.0", | ||
"joi": "^14.3.0", | ||
"lodash": "^4.17.4", | ||
"react": "16.2.0", | ||
"react-dom": "16.2.0", | ||
"uuid": "^3.1.0", | ||
"winston": "^2.3.1" | ||
}, | ||
"scripts": { | ||
"readme": "node misc/readmeData.js | mustache - misc/README.mustache > README.md", | ||
"start": "node src/app.js", | ||
"dev": "nodemon src/app.js" | ||
} | ||
} |
Oops, something went wrong.