-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/#26-code-formatting'
- Loading branch information
Showing
8 changed files
with
282 additions
and
140 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,58 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"node": true | ||
}, | ||
"plugins": ["prettier"], | ||
"extends": ["prettier"], | ||
"parserOptions": { | ||
"ecmaVersion": 8, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"rules": { | ||
"curly": 2, | ||
"dot-notation": 2, | ||
"id-length": 1, | ||
"no-const-assign": 2, | ||
"no-dupe-class-members": 2, | ||
"no-else-return": 2, | ||
"no-inner-declarations": 2, | ||
"no-lonely-if": 2, | ||
"no-magic-numbers": [ | ||
2, | ||
{ | ||
"ignore": [-1, 0, 1, 2] | ||
} | ||
], | ||
"no-shadow": 2, | ||
"no-unneeded-ternary": 2, | ||
"no-unused-expressions": 2, | ||
"no-unused-vars": [ | ||
2, | ||
{ | ||
"args": "none" | ||
} | ||
], | ||
"no-useless-return": 2, | ||
"no-var": 2, | ||
"one-var": [2, "never"], | ||
"prefer-arrow-callback": 2, | ||
"prefer-const": 2, | ||
"prefer-promise-reject-errors": 2, | ||
"prettier/prettier": 2, | ||
"sort-imports": 2, | ||
"sort-keys": [ | ||
2, | ||
"asc", | ||
{ | ||
"caseSensitive": true, | ||
"natural": true | ||
} | ||
], | ||
"sort-vars": 2, | ||
"strict": [2, "global"] | ||
} | ||
} |
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,2 +1,4 @@ | ||
/node_modules | ||
access.log | ||
yarn.lock | ||
package-lock.json |
Empty file.
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,22 @@ | ||
{ | ||
"arrowParens": "avoid", | ||
"bracketSpacing": false, | ||
"endOfLine": "lf", | ||
"htmlWhitespaceSensitivity": "css", | ||
"jsxBracketSameLine": false, | ||
"printWidth": 80, | ||
"proseWrap": "preserve", | ||
"requirePragma": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"overrides": [ | ||
{ | ||
"files": "*.json", | ||
"options": { | ||
"printWidth": 200 | ||
} | ||
} | ||
] | ||
} |
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 |
---|---|---|
|
@@ -28,6 +28,7 @@ npm install | |
# Usage | ||
|
||
Run the server using: | ||
|
||
```bash | ||
npm start | ||
``` | ||
|
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 |
---|---|---|
@@ -1,48 +1,61 @@ | ||
"use strict"; | ||
const minimist = require('minimist'); | ||
|
||
var minimist = require("minimist"); | ||
const TIMEOUT = 5 * 60 * 1000; // eslint-disable-line | ||
const MAX_JOBS = 1000; | ||
const MAX_VEHICLES = 200; | ||
const MAX_REQUEST_SIZE = '1mb'; | ||
const PORT = 3000; | ||
const LOG_DIR = __dirname + '/..'; | ||
const ROUTER = 'osrm'; | ||
|
||
// Config variables. | ||
var cliArgs = minimist(process.argv.slice(2), { | ||
const cliArgs = minimist(process.argv.slice(2), { | ||
alias: { | ||
p: "port", | ||
r: "router" | ||
p: 'port', // eslint-disable-line | ||
r: 'router', // eslint-disable-line | ||
}, | ||
boolean: ["geometry", "override"], | ||
boolean: ['geometry', 'override'], | ||
default: { | ||
port: 3000, // expressjs port | ||
path: "", // VROOM path (if not in $PATH) | ||
maxjobs: "1000", // max number of jobs | ||
maxvehicles: "200", // max number of vehicles | ||
geometry: false, // retrieve geometry (-g) | ||
router: "osrm", // routing backend (osrm, libosrm or ors) | ||
limit: MAX_REQUEST_SIZE, // max request size | ||
logdir: LOG_DIR, // put logs in there | ||
maxjobs: MAX_JOBS, // max number of jobs | ||
maxvehicles: MAX_VEHICLES, // max number of vehicles | ||
override: true, // allow cl option override (-g only so far) | ||
logdir: __dirname + "/..", // put logs in there | ||
limit: "1mb", // max request size | ||
timeout: 5 * 60 * 1000 // milli-seconds. | ||
path: '', // VROOM path (if not in $PATH) | ||
port: PORT, // expressjs port | ||
router: ROUTER, // routing backend (osrm, libosrm or ors) | ||
timeout: TIMEOUT // milli-seconds. | ||
} | ||
}); | ||
|
||
// For each routing profile add a host and a port for use with osrm | ||
// and ors. | ||
var routingServers = { | ||
const routingServers = { | ||
car: { | ||
host: "0.0.0.0", | ||
port: "5000" | ||
host: '0.0.0.0', | ||
port: '5000' | ||
} | ||
}; | ||
|
||
const VROOM_OK_CODE = 0; | ||
const VROOM_INTERNALERROR_CODE = 1; | ||
const VROOM_INPUTERROR_CODE = 2; | ||
const VROOM_ROUTINGERROR_CODE = 3; | ||
const VROOM_TOOLARGE_CODE = 4; | ||
|
||
// Hard-code error codes 1, 2 and 3 as defined in vroom. Add 4 code | ||
// for size checks. | ||
var errorCodes = { | ||
internal: 1, | ||
input: 2, | ||
routing: 3, | ||
tooLarge: 4 | ||
const vroomErrorCodes = { | ||
input: VROOM_INPUTERROR_CODE, | ||
internal: VROOM_INTERNALERROR_CODE, | ||
ok: VROOM_OK_CODE, | ||
routing: VROOM_ROUTINGERROR_CODE, | ||
tooLarge: VROOM_TOOLARGE_CODE | ||
}; | ||
|
||
module.exports = { | ||
errorCodes: errorCodes, | ||
cliArgs: cliArgs, | ||
routingServers: routingServers | ||
routingServers: routingServers, | ||
vroomErrorCodes: vroomErrorCodes | ||
}; |
Oops, something went wrong.