Skip to content

sat-utils/sat-api-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sat-api-lib

npm version

[DEPRECATED] sat-api-lib has been deprecated, all of the modules from it are now included in the sat-api repository

We use this library for creating sat-api using API Gateway. You can use this API to build a standalone API in other frameworks such as Express

Test

$ npm install
$ npm run test

We use nock to record and save API calls to the ElasticSearch instance to speed up tests and freeze results in time.

To change the behaviour of Nock, update NOCK_BACK_MODE to wild, dryrun, record or lockdown. More info here.

Default is lockdown.

Express Example:

process.env.ES_HOST = 'link-to-my-elasticsearh.com';

var express = require('express');
var api = require('sat-api-lib');
var app = express();

app.get('/', function(req, res) {
  var search = new api(req);
  search.simple(function (err, resp) {
    res.send(resp);
  });
});

app.get('/count', function(req, res) {
  var search = new api(req);
  search.count(function (err, resp) {
    res.send(resp);
  });
});

app.get('/geojson', function(req, res) {
  var search = new api(req);
  search.geojson(function (err, resp) {
    res.send(resp);
  });
});

var port = process.env.PORT || 8000;
app.listen(port, function() {
  console.log('Listening on ' + port);
});

About

Sat API Lib was made by Development Seed.

About

[DEPRECATED] A library for creating a search API of public Satellites metadata using Elasticsearch

Resources

License

Stars

Watchers

Forks

Packages

No packages published