-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from urbanriskmap/dev
Merge updates in dev into master
- Loading branch information
Showing
180 changed files
with
56,187 additions
and
1,203 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = { | ||
"extends": ["eslint:recommended", "google"], | ||
"parserOptions": | ||
{ | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
}, | ||
"env": | ||
{ "browser": false, | ||
"es6": true, | ||
"node": true, | ||
"mocha": true | ||
}, | ||
"rules": | ||
{ | ||
"no-multi-str": "off" // not a problem in node apps | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,10 +1,14 @@ | ||
.DS_Store | ||
.env | ||
.idea | ||
.swp | ||
*.swp | ||
|
||
# nyc test coverage | ||
.nyc_output/ | ||
|
||
/coverage | ||
/dist | ||
/node_modules | ||
|
||
*.log | ||
package-lock.json |
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,6 @@ | ||
{ | ||
"ignoreDelimiters": [ | ||
{ "start": "start-non-standard", "end": "end-non-standard" } | ||
], | ||
"esversion":6 | ||
} |
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 |
---|---|---|
@@ -1,17 +1,27 @@ | ||
dist: precise | ||
language: node_js | ||
node_js: | ||
- "6.10.0" | ||
sudo: false | ||
sudo: true | ||
|
||
addons: | ||
postgresql: "9.5" | ||
# apt: | ||
# packages: | ||
# - postgresql-9.5-postgis-2.3 | ||
|
||
branches: | ||
only: | ||
- master | ||
- dev | ||
|
||
notifications: | ||
- server-object-refactor | ||
- report-archive | ||
|
||
before_install: | ||
- if [[ `npm -v` != 3* ]]; then npm i -g npm@3; fi | ||
- if [[ `npm -v` != 3* ]]; then ~/.nvm/versions/node/v4.1.1/bin/npm install -g [email protected]; fi | ||
- export DATABASE=cognicity_server_testing ; git clone -b master https://github.com/urbanriskmap/cognicity-schema.git urbanriskmap/cognicity-schema && cd urbanriskmap/cognicity-schema && bash build/run.sh && cd - | ||
|
||
install: | ||
- npm install | ||
|
||
after_success: npm run coverage |
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,127 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSDoc: Source: api/index.js</title> | ||
|
||
<script src="scripts/prettify/prettify.js"> </script> | ||
<script src="scripts/prettify/lang-css.js"> </script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">Source: api/index.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>/** | ||
* CogniCity Server Data API | ||
* @module src/api/index | ||
**/ | ||
import {Router} from 'express'; | ||
|
||
// Import the dependencies we need to handle the request | ||
import errorHandler from 'api-error-handler'; | ||
|
||
// Import validation dependencies | ||
import validate from 'celebrate'; | ||
|
||
// Get the current version | ||
import {version} from '../../package.json'; | ||
|
||
// Import our routes | ||
import cards from './routes/cards'; | ||
import cities from './routes/cities'; | ||
import feeds from './routes/feeds'; | ||
import floodgauges from './routes/floodgauges'; | ||
import floods from './routes/floods'; | ||
import infrastructure from './routes/infrastructure'; | ||
import reports from './routes/reports'; | ||
|
||
/** | ||
* Build CogniCity Server Data API | ||
* @alias module:src/api/index | ||
* @param {Object} config Server configuration | ||
* @param {Object} db PG Promise database instance | ||
* @param {Object} logger Configured Winston logger instance | ||
* @return {Object} api Express router object for API routes | ||
**/ | ||
export default ({config, db, logger}) => { | ||
let api = Router(); // eslint-disable-line new-cap | ||
|
||
// Return the API version | ||
api.get('/', (req, res) => { | ||
res.status(200).json({version}); | ||
}); | ||
|
||
// Mount the various endpoints | ||
// api.use('/areas', cards({ config, db, logger }));// TODO: local_areas | ||
api.use('/cards', cards({config, db, logger})); | ||
api.use('/cities', cities({config, db, logger})); | ||
api.use('/feeds', feeds({config, db, logger})); | ||
api.use('/floodgauges', floodgauges({config, db, logger})); | ||
api.use('/floods', floods({config, db, logger})); | ||
api.use('/infrastructure', infrastructure({config, db, logger})); | ||
api.use('/reports', reports({config, db, logger})); | ||
|
||
// Handle validation errors (wording can be overridden using err.isJoi) | ||
api.use(validate.errors()); | ||
|
||
// Handle not found errors | ||
api.use((req, res) => { | ||
res.status(404).json({message: 'URL not found', url: req.url}); | ||
}); | ||
|
||
// Handle errors gracefully returning nicely formatted json | ||
api.use(errorHandler()); | ||
|
||
return api; | ||
}; | ||
</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<nav> | ||
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="db%250ADatabase%2520initializermodule_.html">db | ||
Database initializer</a></li><li><a href="module-lib_cap.html">lib/cap</a></li><li><a href="module-src_api_cards_index.html">src/api/cards/index</a></li><li><a href="module-src_api_cards_model.html">src/api/cards/model</a></li><li><a href="module-src_api_cities_index.html">src/api/cities/index</a></li><li><a href="module-src_api_cities_model.html">src/api/cities/model</a></li><li><a href="module-src_api_feeds_index.html">src/api/feeds/index</a></li><li><a href="module-src_api_feeds_model.html">src/api/feeds/model</a></li><li><a href="module-src_api_floodgauges_index.html">src/api/floodgauges/index</a></li><li><a href="module-src_api_floodgauges_model.html">src/api/floodgauges/model</a></li><li><a href="module-src_api_floods_index.html">src/api/floods/index</a></li><li><a href="module-src_api_floods_model.html">src/api/floods/model</a></li><li><a href="module-src_api_index.html">src/api/index</a></li><li><a href="module-src_api_infrastructure_index.html">src/api/infrastructure/index</a></li><li><a href="module-src_api_infrastructure_model.html">src/api/infrastructure/model</a></li><li><a href="module-src_api_reports_archive_index.html">src/api/reports/archive/index</a></li><li><a href="module-src_api_reports_archive_model.html">src/api/reports/archive/model</a></li><li><a href="module-src_api_reports_index.html">src/api/reports/index</a></li><li><a href="module-src_api_reports_model.html">src/api/reports/model</a></li><li><a href="server%250ACore%2520server%2520modulemodule_.html">server | ||
Core server module</a></li><li><a href="src_test_testCAP%250AA%2520module%2520to%2520test%2520the%2520CAP%2520data%2520format%2520utilitymodule_.html">src/test/testCAP | ||
A module to test the CAP data format utility</a></li><li><a href="src_test_testCards%250AA%2520module%2520to%2520test%2520the%2520_cards%2520endpointmodule_.html">src/test/testCards | ||
A module to test the /cards endpoint</a></li><li><a href="test_testCities%250AA%2520module%2520to%2520test%2520the%2520_cities%2520endpointmodule_.html">test/testCities | ||
A module to test the /cities endpoint</a></li><li><a href="test_testDB%250AA%2520module%2520to%2520test%2520the%2520db%2520utility%2520modulemodule_.html">test/testDB | ||
A module to test the db utility module</a></li><li><a href="test_testFeeds%250AA%2520module%2520to%2520test%2520the%2520_feeds%2520endpointmodule_.html">test/testFeeds | ||
A module to test the /feeds endpoint</a></li><li><a href="test_testFloods%250AA%2520module%2520to%2520test%2520the%2520_floods%2520endpointmodule_.html">test/testFloods | ||
A module to test the /floods endpoint</a></li><li><a href="test_testFloodsgauges%250AA%2520module%2520to%2520test%2520the%2520_floodgauges%2520endpointmodule_.html">test/testFloodsgauges | ||
A module to test the /floodgauges endpoint</a></li><li><a href="test_testInfrastructure%250AA%2520module%2520to%2520test%2520the%2520_infrastructure%2520endpointmodule_.html">test/testInfrastructure | ||
A module to test the /infrastructure endpoint</a></li><li><a href="test_testReports%250AA%2520module%2520to%2520test%2520the%2520_reports%2520endpointmodule_.html">test/testReports | ||
A module to test the /reports endpoint</a></li><li><a href="test_testReportsArchive%250AA%2520module%2520to%2520test%2520the%2520_reports_archive%2520endpointmodule_.html">test/testReportsArchive | ||
A module to test the /reports/archive endpoint</a></li><li><a href="test_testServer%250AA%2520module%2520to%2520test%2520top-level%2520API%2520routes%2520from%2520the%2520servermodule_.html">test/testServer | ||
A module to test top-level API routes from the server</a></li></ul><h3>Classes</h3><ul><li><a href="module-lib_cap.html">lib/cap</a></li></ul> | ||
</nav> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri Jun 30 2017 11:48:01 GMT-0400 (EDT) | ||
</footer> | ||
|
||
<script> prettyPrint(); </script> | ||
<script src="scripts/linenumber.js"> </script> | ||
</body> | ||
</html> |
Oops, something went wrong.