2016-12-13 23:32:41 +08:00
|
|
|
SQL API for carto.com
|
2011-06-13 11:23:02 +08:00
|
|
|
========================
|
2012-06-02 04:19:02 +08:00
|
|
|
|
2015-03-01 00:06:39 +08:00
|
|
|
[![Build Status](https://travis-ci.org/CartoDB/CartoDB-SQL-API.png?branch=master)](https://travis-ci.org/CartoDB/CartoDB-SQL-API)
|
2013-10-01 00:02:48 +08:00
|
|
|
|
2014-09-24 16:32:54 +08:00
|
|
|
Provides a node.js based API for running SQL queries against CartoDB.
|
2011-06-13 11:23:02 +08:00
|
|
|
|
2012-06-02 04:19:02 +08:00
|
|
|
* Users are authenticated over OAuth or via an API KEY.
|
|
|
|
* Authenticated requests to this API should always be made over SSL.
|
2011-06-13 11:23:02 +08:00
|
|
|
|
2011-10-08 00:19:02 +08:00
|
|
|
|
2011-06-30 19:13:13 +08:00
|
|
|
core requirements
|
2014-09-24 16:32:54 +08:00
|
|
|
-----------------
|
2019-01-02 18:16:00 +08:00
|
|
|
* Node >= 10.14.2 or 6.9.2
|
|
|
|
* npm >= 6.4.1 || 3.10.9 || 3.10.10
|
2017-08-11 20:48:01 +08:00
|
|
|
* Postgres `9.3+`.
|
|
|
|
* Postgis `2.2`.
|
|
|
|
* [CartoDB Postgres Extension](https://github.com/CartoDB/cartodb-postgresql/blob/0.19.2/README.md) `0.19+`.
|
|
|
|
* GDAL `1.11.0` (bin utils). See [installing GDAL](http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries)
|
|
|
|
* zip commandline tool.
|
|
|
|
* Redis `3`, recommended reversion `3.0.2`.
|
2011-06-30 19:13:13 +08:00
|
|
|
|
2014-09-24 16:32:54 +08:00
|
|
|
|
2012-07-24 15:30:25 +08:00
|
|
|
Install dependencies
|
2014-09-24 16:32:54 +08:00
|
|
|
--------------------
|
2012-07-24 15:30:25 +08:00
|
|
|
|
2019-01-02 18:16:00 +08:00
|
|
|
- Node.js >= 10.14.2:
|
|
|
|
```
|
|
|
|
$ mv npm-shrinkwrap.json npm-shrinkwrap.json.backup
|
|
|
|
$ npm ci
|
|
|
|
$ mv npm-shrinkwrap.json.backup npm-shrinkwrap.json
|
|
|
|
```
|
|
|
|
|
|
|
|
- Node.js 6.9.2:
|
2014-09-24 16:32:54 +08:00
|
|
|
```sh
|
2012-07-24 15:30:25 +08:00
|
|
|
npm install
|
|
|
|
```
|
|
|
|
|
2014-09-24 16:32:54 +08:00
|
|
|
|
2012-03-14 02:32:01 +08:00
|
|
|
usage
|
|
|
|
-----
|
|
|
|
|
2012-07-24 01:57:38 +08:00
|
|
|
Create and edit config/environments/<environment>.js from .js.example files.
|
|
|
|
You may find the ./configure script useful to make an edited copy for you,
|
|
|
|
see ```./configure --help``` for a list of supported switches.
|
|
|
|
|
2012-03-14 02:32:01 +08:00
|
|
|
Make sure redis is running and knows about active cartodb user.
|
|
|
|
|
2012-07-24 17:30:42 +08:00
|
|
|
Make sure your PostgreSQL server is running, is accessible on
|
|
|
|
the host and port specified in the <environment> file, has
|
2013-11-06 00:49:10 +08:00
|
|
|
a 'publicuser' role (or whatever you set ``db_pubuser`` configuration
|
|
|
|
directive to) and trusts user authentication from localhost
|
2012-07-24 17:30:42 +08:00
|
|
|
connections.
|
|
|
|
|
2014-09-24 16:32:54 +08:00
|
|
|
```sh
|
2013-12-18 17:24:31 +08:00
|
|
|
node app.js <environment>
|
2012-03-14 02:32:01 +08:00
|
|
|
```
|
|
|
|
|
2014-09-24 16:32:54 +08:00
|
|
|
Supported <environment> values are development, test, production
|
2012-03-16 17:31:03 +08:00
|
|
|
|
2012-07-24 17:08:13 +08:00
|
|
|
See doc/API.md for API documentation.
|
|
|
|
For examples of use, see under test/.
|
2012-03-14 02:32:01 +08:00
|
|
|
|
2011-06-30 20:06:23 +08:00
|
|
|
|
2011-10-08 00:19:02 +08:00
|
|
|
tests
|
2014-09-24 16:32:54 +08:00
|
|
|
-----
|
2012-07-24 16:30:57 +08:00
|
|
|
|
2014-09-24 16:32:54 +08:00
|
|
|
Run with:
|
2012-03-16 21:18:43 +08:00
|
|
|
|
2014-09-24 16:32:54 +08:00
|
|
|
```sh
|
|
|
|
npm test
|
|
|
|
```
|
2014-06-19 17:44:33 +08:00
|
|
|
|
2014-09-24 16:32:54 +08:00
|
|
|
If any issue arise see test/README.md
|
2014-06-19 17:44:33 +08:00
|
|
|
|
2014-09-24 16:32:54 +08:00
|
|
|
Note that the environment should be set to ensure the default
|
|
|
|
PostgreSQL user is superuser (PGUSER=postgres make check).
|
2015-09-08 22:40:12 +08:00
|
|
|
|
|
|
|
Contributing
|
|
|
|
---
|
|
|
|
|
|
|
|
See [CONTRIBUTING.md](CONTRIBUTING.md).
|