chore: update package versions and readme

This commit is contained in:
Martin Grotz 2020-09-29 22:08:29 +02:00 committed by uwewoessner
parent 70e2ec5672
commit 3fb02b5809
7 changed files with 350 additions and 2058 deletions

View file

@ -1,4 +1,30 @@
# obsAPI # OpenBikeSensor Web API
OpenBikeSensor Web API The backend API for the [OpenBikeSensor](https://zweirat-stuttgart.de/projekte/openbikesensor/) Web App.
## Running it
### Requirements
A working installation of npm and node.js - get the latest node.js LTS release at [the node.js homepage](https://nodejs.org/en/) and verify it's working via `node -v` and `npm -v` in a command prompt of your choice.
A working installation of [Docker](https://www.docker.com) for the used containerized MongoDB.
### First start
To get started you need to download all used packages with `npm i` in the project's root folder first.
Next up is our local MongoDB. This uses docker but can be conveniently started via `sudo npm run mongo:start` (at least in Ubuntu Linux).
Afterwards the dev server is started with `npm run dev` and can be called via `http://localhost:3000/api`.
To completely stop the project after running it a call to `sudo npm run mongo:stop` is necessary.
### Running the tests
Just execute `npm run test` while both the node.js server and the MongoDB are up and running.
Warning: At the moment (2020-09-29) there are no tests.
### Uploading a track for test purposes
Uploading a track to the local server requires multiple steps, as uploading is not possible via the dummy upload form in the corresponding web app yet:
- Create a user in the web app and copy the user id, which can be found at (http://localhost:4200/settings) as "API key"
- Import the [Postman](https://www.postman.com) script "add-track.json" from the "postman-examples" into Postman
- In each of the three requests add your user id in the "Pre-request script" tab as the value for the "UserId" variable
- As tracks have to be split into smaller parts to get a working upload from the sensor you have to run the three requests in the order of: begin -> add -> end
- View your freshly uploaded track at (http://localhost:4200) -> Home -> Your feed

285
package-lock.json generated
View file

@ -1,5 +1,5 @@
{ {
"name": "conduit-node", "name": "open-bike-sensor-web-api",
"version": "1.0.0", "version": "1.0.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
@ -211,9 +211,9 @@
"dev": true "dev": true
}, },
"bl": { "bl": {
"version": "2.2.0", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/bl/-/bl-2.2.0.tgz", "resolved": "https://registry.npmjs.org/bl/-/bl-2.2.1.tgz",
"integrity": "sha512-wbgvOpqopSr7uq6fJrLH8EsvYMJf9gzfo2jCsL2eTy75qXPukA4pCgHamOQkZtY5vmfVtjB+P3LNlMHW5CEZXA==", "integrity": "sha512-6Pesp1w0DEX1N550i/uGV/TqucVL4AM/pgThFSN/Qq9si1/DF9aIHs1BxD8V/QU0HoeHO6cQRTAuYnLPKq1e4g==",
"requires": { "requires": {
"readable-stream": "^2.3.5", "readable-stream": "^2.3.5",
"safe-buffer": "^5.1.1" "safe-buffer": "^5.1.1"
@ -338,9 +338,9 @@
} }
}, },
"bson": { "bson": {
"version": "1.1.4", "version": "1.1.5",
"resolved": "https://registry.npmjs.org/bson/-/bson-1.1.4.tgz", "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.5.tgz",
"integrity": "sha512-S/yKGU1syOMzO86+dGpg2qGoDL0zvzcb262G+gqEy6TgP6rt6z6qxSFX/8X6vLC91P7G7C3nLs0+bvDzmvBA3Q==" "integrity": "sha512-kDuEzldR21lHciPQAIulLs1LZlCXdLziXI6Mb/TDkwXhb//UORJNPXgcRs2CuO4H0DcMkpfT3/ySsP3unoZjBg=="
}, },
"buffer-equal-constant-time": { "buffer-equal-constant-time": {
"version": "1.0.1", "version": "1.0.1",
@ -406,9 +406,9 @@
} }
}, },
"chardet": { "chardet": {
"version": "1.1.0", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/chardet/-/chardet-1.1.0.tgz", "resolved": "https://registry.npmjs.org/chardet/-/chardet-1.2.1.tgz",
"integrity": "sha512-K6BWWdt9ncg6TDTX42J57s9zZWVI1DXVYQ6zUM8dZUB2TDeV5ia4kDei19r/pMxNzSGYYf6LqHsyvEybvTPHuA==", "integrity": "sha512-bnDt+69nS8Hi7Xmt0uDiQ32/hRpMK/0pc4lc32Y87voBgdsz26VZXOyo5VNQWQfe7rUsevZIfWB82C5QSpCXcQ==",
"dev": true "dev": true
}, },
"charset": { "charset": {
@ -503,9 +503,9 @@
} }
}, },
"commander": { "commander": {
"version": "5.1.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-6.1.0.tgz",
"integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", "integrity": "sha512-wl7PNrYWd2y5mp1OK/LhTlv8Ff4kQJQRXXAvF+uU/TPNiVJUxZLRYGj/B0y/lPGAVcSbJqH2Za/cvHmrPMC8mA==",
"dev": true "dev": true
}, },
"concat-map": { "concat-map": {
@ -571,9 +571,9 @@
"dev": true "dev": true
}, },
"csv-parse": { "csv-parse": {
"version": "4.10.1", "version": "4.12.0",
"resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-4.10.1.tgz", "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-4.12.0.tgz",
"integrity": "sha512-gdDJVchi0oSLIcYXz1H/VSgLE6htHDqJyFsRU/vTkQgmVOZ3S0IR2LXnNbWUYG7VD76dYVwdfBLyx8AX9+An8A==", "integrity": "sha512-wPQl3H79vWLPI8cgKFcQXl0NBgYYEqVnT1i6/So7OjMpsI540oD7p93r3w6fDSyPvwkTepG05F69/7AViX2lXg==",
"dev": true "dev": true
}, },
"dashdash": { "dashdash": {
@ -650,9 +650,9 @@
}, },
"dependencies": { "dependencies": {
"domelementtype": { "domelementtype": {
"version": "2.0.1", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.1.tgz", "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.2.tgz",
"integrity": "sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ==", "integrity": "sha512-wFwTwCVebUrMgGeAwRL/NhZtHAUyT9n9yg4IMDwf10+6iCMxSkVq9MGCVEH+QZWo1nNidy8kNvwmv4zWHDTqvA==",
"dev": true "dev": true
}, },
"entities": { "entities": {
@ -726,9 +726,9 @@
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
}, },
"ejs": { "ejs": {
"version": "3.1.3", "version": "3.1.5",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.3.tgz", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.5.tgz",
"integrity": "sha512-wmtrUGyfSC23GC/B1SMv2ogAUgbQEtDmTIhfqielrG5ExIM9TP4UoYdi90jLF1aTcsWCJNEO0UrgKzP0y3nTSg==", "integrity": "sha512-dldq3ZfFtgVTJMLjOe+/3sROTzALlL9E34V4/sDtUd/KlBSS0s6U1/+WPE1B4sj9CXHJpL1M6rhNJnc9Wbal9w==",
"requires": { "requires": {
"jake": "^10.6.1" "jake": "^10.6.1"
} }
@ -790,9 +790,9 @@
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
}, },
"eventemitter3": { "eventemitter3": {
"version": "4.0.4", "version": "4.0.7",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.4.tgz", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
"integrity": "sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
"dev": true "dev": true
}, },
"express": { "express": {
@ -833,9 +833,9 @@
} }
}, },
"express-jwt": { "express-jwt": {
"version": "5.3.3", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/express-jwt/-/express-jwt-5.3.3.tgz", "resolved": "https://registry.npmjs.org/express-jwt/-/express-jwt-6.0.0.tgz",
"integrity": "sha512-UdB8p5O8vGYTKm3SfREnLgVGIGEHcL3lrVyi3ebEX2qhMuagN623ju7ywWis+qYL+CXE7G1qPc2bCPBAg2MxZQ==", "integrity": "sha512-C26y9myRjx7CyhZ+BAT3p+gQyRCoDZ7qo8plCvLDaRT6je6ALIAQknT6XLVQGFKwIy/Ux7lvM2MNap5dt0T7gA==",
"requires": { "requires": {
"async": "^1.5.0", "async": "^1.5.0",
"express-unless": "^0.3.0", "express-unless": "^0.3.0",
@ -886,9 +886,9 @@
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
}, },
"faker": { "faker": {
"version": "4.1.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/faker/-/faker-4.1.0.tgz", "resolved": "https://registry.npmjs.org/faker/-/faker-5.1.0.tgz",
"integrity": "sha1-HkW7vsxndLPBlfrSg1EJxtdIzD8=", "integrity": "sha512-RrWKFSSA/aNLP0g3o2WW1Zez7/MnMr7xkiZmoCfAGZmdkDQZ6l2KtuXHN5XjdvpRjDl8+3vf+Rrtl06Z352+Mw==",
"dev": true "dev": true
}, },
"fast-json-stable-stringify": { "fast-json-stable-stringify": {
@ -1535,9 +1535,9 @@
"dev": true "dev": true
}, },
"lodash": { "lodash": {
"version": "4.17.15", "version": "4.17.20",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
"dev": true "dev": true
}, },
"lodash.clonedeep": { "lodash.clonedeep": {
@ -1632,9 +1632,9 @@
} }
}, },
"marked": { "marked": {
"version": "1.1.0", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/marked/-/marked-1.1.0.tgz", "resolved": "https://registry.npmjs.org/marked/-/marked-1.1.1.tgz",
"integrity": "sha512-EkE7RW6KcXfMHy2PA7Jg0YJE1l8UPEZE8k45tylzmZM30/r1M1MUXWQfJlrSbsTeh7m/XTwHbWUENvAJZpp1YA==", "integrity": "sha512-mJzT8D2yPxoPh7h0UXkB+dBj4FykPJ2OIfxAWeIHrvoHDkFxukV/29QxoFQoPM6RLEwhIFdJpmKBlqVM3s2ZIw==",
"dev": true "dev": true
}, },
"media-typer": { "media-typer": {
@ -1733,11 +1733,11 @@
"dev": true "dev": true
}, },
"mongodb": { "mongodb": {
"version": "3.5.9", "version": "3.6.2",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.5.9.tgz", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.2.tgz",
"integrity": "sha512-vXHBY1CsGYcEPoVWhwgxIBeWqP3dSu9RuRDsoLRPTITrcrgm1f0Ubu1xqF9ozMwv53agmEiZm0YGo+7WL3Nbug==", "integrity": "sha512-sSZOb04w3HcnrrXC82NEh/YGCmBuRgR+C1hZgmmv4L6dBz4BkRse6Y8/q/neXer9i95fKUBbFi4KgeceXmbsOA==",
"requires": { "requires": {
"bl": "^2.2.0", "bl": "^2.2.1",
"bson": "^1.1.4", "bson": "^1.1.4",
"denque": "^1.4.1", "denque": "^1.4.1",
"require_optional": "^1.0.1", "require_optional": "^1.0.1",
@ -1746,19 +1746,19 @@
} }
}, },
"mongoose": { "mongoose": {
"version": "5.9.20", "version": "5.10.7",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.9.20.tgz", "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.10.7.tgz",
"integrity": "sha512-vRP6Csu2obzSl3ed7kTQMrolBNgweiRJ/eBU1PSe/rJfjqWS1oqDE2D1ZPGxkVOsKXs7Gyd84GAXerj8IB2UWg==", "integrity": "sha512-oiofFrD4I5p3PhJXn49QyrU1nX5CY01qhPkfMMrXYPhkfGLEJVwFVO+0PsCxD91A2kQP+d/iFyk5U8e86KI8eQ==",
"requires": { "requires": {
"bson": "^1.1.4", "bson": "^1.1.4",
"kareem": "2.3.1", "kareem": "2.3.1",
"mongodb": "3.5.9", "mongodb": "3.6.2",
"mongoose-legacy-pluralize": "1.0.2", "mongoose-legacy-pluralize": "1.0.2",
"mpath": "0.7.0", "mpath": "0.7.0",
"mquery": "3.2.2", "mquery": "3.2.2",
"ms": "2.1.2", "ms": "2.1.2",
"regexp-clone": "1.0.0", "regexp-clone": "1.0.0",
"safe-buffer": "5.1.2", "safe-buffer": "5.2.1",
"sift": "7.0.1", "sift": "7.0.1",
"sliced": "1.0.1" "sliced": "1.0.1"
}, },
@ -1767,6 +1767,11 @@
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
} }
} }
}, },
@ -1846,35 +1851,36 @@
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
}, },
"neo-async": { "neo-async": {
"version": "2.6.1", "version": "2.6.2",
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
"integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
"dev": true "dev": true
}, },
"newman": { "newman": {
"version": "5.1.0", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/newman/-/newman-5.1.0.tgz", "resolved": "https://registry.npmjs.org/newman/-/newman-5.2.0.tgz",
"integrity": "sha512-V3HrweC3t7tsHshOiu8cG2dbHvJwMf5/rxwqBHAK/fZq/H1CGPSLM/T6IhbTpbPqIs+GpklQXO9VsFFuUf7Nfw==", "integrity": "sha512-VzvKHhdPM7QvuwQfnJMj50hHLf27AE9hCAbMgbP5aXIQ12eKhrL3if1U0OWcB+BvSLdww9nKvMDwvuF72/ipFw==",
"dev": true, "dev": true,
"requires": { "requires": {
"async": "3.2.0", "async": "3.2.0",
"chardet": "1.1.0", "chardet": "1.2.1",
"cli-progress": "3.8.2", "cli-progress": "3.8.2",
"cli-table3": "0.6.0", "cli-table3": "0.6.0",
"colors": "1.4.0", "colors": "1.4.0",
"commander": "5.1.0", "commander": "6.1.0",
"csv-parse": "4.10.1", "csv-parse": "4.12.0",
"eventemitter3": "4.0.4", "eventemitter3": "4.0.7",
"filesize": "6.1.0", "filesize": "6.1.0",
"lodash": "4.17.15", "lodash": "4.17.20",
"mkdirp": "1.0.4", "mkdirp": "1.0.4",
"postman-collection": "3.6.2", "postman-collection": "3.6.6",
"postman-collection-transformer": "3.3.2", "postman-collection-transformer": "3.3.3",
"postman-request": "2.88.1-postman.23", "postman-request": "2.88.1-postman.24",
"postman-runtime": "7.26.0", "postman-runtime": "7.26.5",
"pretty-ms": "7.0.0", "pretty-ms": "7.0.0",
"semver": "7.3.2", "semver": "7.3.2",
"serialised-error": "1.1.3", "serialised-error": "1.1.3",
"tough-cookie": "3.0.1",
"word-wrap": "1.2.3", "word-wrap": "1.2.3",
"xmlbuilder": "15.1.1" "xmlbuilder": "15.1.1"
}, },
@ -1890,6 +1896,17 @@
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
"integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
"dev": true "dev": true
},
"tough-cookie": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz",
"integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==",
"dev": true,
"requires": {
"ip-regex": "^2.1.0",
"psl": "^1.1.28",
"punycode": "^2.1.1"
}
} }
} }
}, },
@ -3488,9 +3505,9 @@
"dev": true "dev": true
}, },
"postcss": { "postcss": {
"version": "7.0.32", "version": "7.0.35",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.32.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.35.tgz",
"integrity": "sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==", "integrity": "sha512-3QT8bBJeX/S5zKTTjTCIjRF3If4avAT6kqxcASlTWEtAFCb9NH0OUxNDfgZSWdP5fJnBYCMEWkIFfWeugjzYMg==",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "^2.4.2", "chalk": "^2.4.2",
@ -3510,34 +3527,34 @@
} }
}, },
"postman-collection": { "postman-collection": {
"version": "3.6.2", "version": "3.6.6",
"resolved": "https://registry.npmjs.org/postman-collection/-/postman-collection-3.6.2.tgz", "resolved": "https://registry.npmjs.org/postman-collection/-/postman-collection-3.6.6.tgz",
"integrity": "sha512-daouhC0qe9ThF0EgIgWSJQxEj1fLctRREnWpSC+Tg2Sel/9keEho9zyWET5dYHPisPZcxGCqS3Q+BN/WQO+SAg==", "integrity": "sha512-fm9AGKHbL2coSzD5nw+F07JrX7jzqu2doGIXevPPrwlpTZyTM6yagEdENeO/Na8rSUrI1+tKPj+TgAFiLvtF4w==",
"dev": true, "dev": true,
"requires": { "requires": {
"escape-html": "1.0.3", "escape-html": "1.0.3",
"faker": "4.1.0", "faker": "5.1.0",
"file-type": "3.9.0", "file-type": "3.9.0",
"http-reasons": "0.1.0", "http-reasons": "0.1.0",
"iconv-lite": "0.5.1", "iconv-lite": "0.6.2",
"liquid-json": "0.3.1", "liquid-json": "0.3.1",
"lodash": "4.17.15", "lodash": "4.17.20",
"marked": "1.1.0", "marked": "1.1.1",
"mime-format": "2.0.0", "mime-format": "2.0.0",
"mime-types": "2.1.27", "mime-types": "2.1.27",
"postman-url-encoder": "2.1.1", "postman-url-encoder": "2.1.3",
"sanitize-html": "1.20.1", "sanitize-html": "1.20.1",
"semver": "7.3.2", "semver": "7.3.2",
"uuid": "3.4.0" "uuid": "3.4.0"
}, },
"dependencies": { "dependencies": {
"iconv-lite": { "iconv-lite": {
"version": "0.5.1", "version": "0.6.2",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.1.tgz", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.2.tgz",
"integrity": "sha512-ONHr16SQvKZNSqjQT9gy5z24Jw+uqfO02/ngBSBoqChZ+W8qXX7GPRa1RoUnzGADw8K63R1BXUMzarCVQBpY8Q==", "integrity": "sha512-2y91h5OpQlolefMPmUlivelittSWy0rP+oYVpn6A7GwVHNE8AWzoYOBNmlwks3LobaJxgHCYZAnyNo2GgpNRNQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"safer-buffer": ">= 2.1.2 < 3" "safer-buffer": ">= 2.1.2 < 3.0.0"
} }
}, },
"mime-db": { "mime-db": {
@ -3564,25 +3581,37 @@
} }
}, },
"postman-collection-transformer": { "postman-collection-transformer": {
"version": "3.3.2", "version": "3.3.3",
"resolved": "https://registry.npmjs.org/postman-collection-transformer/-/postman-collection-transformer-3.3.2.tgz", "resolved": "https://registry.npmjs.org/postman-collection-transformer/-/postman-collection-transformer-3.3.3.tgz",
"integrity": "sha512-ZhhmrOZvAGZkPaX6r4j8G4vR1LHSSHXsGIxyQfMCdzSZqaW0H/d/4L0jqTYqjktb9aTkgHh61jKguM1HQ/L4Cw==", "integrity": "sha512-Ra0hfljwB6xnGJ7a638K0TkXTf5BuwGNo1Ahpa9ECehOTOlUFisE8dqX5VZl04QGbpvN5nmr0rwrtLXtK53Abg==",
"dev": true, "dev": true,
"requires": { "requires": {
"commander": "5.1.0", "commander": "5.1.0",
"inherits": "2.0.4", "inherits": "2.0.4",
"intel": "1.2.0", "intel": "1.2.0",
"lodash": "4.17.15", "lodash": "4.17.19",
"semver": "7.3.2", "semver": "7.3.2",
"strip-json-comments": "3.1.0" "strip-json-comments": "3.1.1"
}, },
"dependencies": { "dependencies": {
"commander": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz",
"integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==",
"dev": true
},
"inherits": { "inherits": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true "dev": true
}, },
"lodash": {
"version": "4.17.19",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
"dev": true
},
"semver": { "semver": {
"version": "7.3.2", "version": "7.3.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
@ -3592,9 +3621,9 @@
} }
}, },
"postman-request": { "postman-request": {
"version": "2.88.1-postman.23", "version": "2.88.1-postman.24",
"resolved": "https://registry.npmjs.org/postman-request/-/postman-request-2.88.1-postman.23.tgz", "resolved": "https://registry.npmjs.org/postman-request/-/postman-request-2.88.1-postman.24.tgz",
"integrity": "sha512-ftqsjGCGKjk23c+gy85aw1Ubs1MIsULhkZ5D9IMuKP8jiGJXW7avNk9jMVfFcyONayvVllfyJugPHZydbt1baA==", "integrity": "sha512-afW2QxA9YCSaMUBFGRWvxnyjN4SqgXC5HqKJ0DFNfbx4ZW6AsBCFXeb5NAFgCH3kZ/og0XhUSDV+imjWwahLLg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@postman/form-data": "~3.1.0", "@postman/form-data": "~3.1.0",
@ -3622,9 +3651,9 @@
}, },
"dependencies": { "dependencies": {
"http-signature": { "http-signature": {
"version": "1.3.4", "version": "1.3.5",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.4.tgz", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.5.tgz",
"integrity": "sha512-CbG3io8gUSIxNNSgq+XMjgpTMzAeVRipxVXjuGrDhH5M1a2kZ03w20s8FCLR1NjnnJj10KbvabvckmtQcYNb9g==", "integrity": "sha512-NwoTQYSJoFt34jSBbwzDHDofoA61NGXzu6wXh95o1Ry62EnmKjXb/nR/RknLeZ3G/uGwrlKNY2z7uPt+Cdl7Tw==",
"dev": true, "dev": true,
"requires": { "requires": {
"assert-plus": "^1.0.0", "assert-plus": "^1.0.0",
@ -3641,26 +3670,26 @@
} }
}, },
"postman-runtime": { "postman-runtime": {
"version": "7.26.0", "version": "7.26.5",
"resolved": "https://registry.npmjs.org/postman-runtime/-/postman-runtime-7.26.0.tgz", "resolved": "https://registry.npmjs.org/postman-runtime/-/postman-runtime-7.26.5.tgz",
"integrity": "sha512-ueQdLL1PtvfVbzg46eKSy/9tpJz1nIDrJVRabpTph3j6Uz4otB5oC63SW8c50QcOGOn1Q1MlNDYN8mWjvRyPgg==", "integrity": "sha512-5sY4iWjG4GeGQ5o4QAJkAt79jmcZhOrs3XSbtCLrs4NqoZpTBx5WDQr6h1Dy4Y8Q0X/9NMCYqF/c5pnsqUyDCQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"async": "2.6.3", "async": "2.6.3",
"aws4": "1.10.0", "aws4": "1.10.1",
"eventemitter3": "4.0.4", "eventemitter3": "4.0.7",
"handlebars": "4.7.6", "handlebars": "4.7.6",
"http-reasons": "0.1.0", "http-reasons": "0.1.0",
"httpntlm": "1.7.6", "httpntlm": "1.7.6",
"inherits": "2.0.4", "inherits": "2.0.4",
"js-sha512": "0.8.0", "js-sha512": "0.8.0",
"lodash": "4.17.15", "lodash": "4.17.20",
"node-oauth1": "1.3.0", "node-oauth1": "1.3.0",
"performance-now": "2.1.0", "performance-now": "2.1.0",
"postman-collection": "3.6.2", "postman-collection": "3.6.6",
"postman-request": "2.88.1-postman.23", "postman-request": "2.88.1-postman.24",
"postman-sandbox": "3.5.4", "postman-sandbox": "3.5.9",
"postman-url-encoder": "2.1.1", "postman-url-encoder": "2.1.3",
"resolve-from": "5.0.0", "resolve-from": "5.0.0",
"serialised-error": "1.1.3", "serialised-error": "1.1.3",
"tough-cookie": "3.0.1", "tough-cookie": "3.0.1",
@ -3677,9 +3706,9 @@
} }
}, },
"aws4": { "aws4": {
"version": "1.10.0", "version": "1.10.1",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.1.tgz",
"integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==", "integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==",
"dev": true "dev": true
}, },
"inherits": { "inherits": {
@ -3708,17 +3737,17 @@
} }
}, },
"postman-sandbox": { "postman-sandbox": {
"version": "3.5.4", "version": "3.5.9",
"resolved": "https://registry.npmjs.org/postman-sandbox/-/postman-sandbox-3.5.4.tgz", "resolved": "https://registry.npmjs.org/postman-sandbox/-/postman-sandbox-3.5.9.tgz",
"integrity": "sha512-spo4UudKdHZ7GsTpkg+fDgwWAYuSaR7pOaMRHkIWR7IArG4iTf1Rm9BDe+vyy8ACFWtOLFWAnOYqPKnLhN6DVA==", "integrity": "sha512-B9mREFulQuYOa9+B7rklb94d9iZ6EYyhsUvdIfxphGUByimb6mOhumWV0sGbrtxVTsCAtTpN/68Shm7NCjrZ0A==",
"dev": true, "dev": true,
"requires": { "requires": {
"inherits": "2.0.4", "inherits": "2.0.4",
"lodash": "4.17.15", "lodash": "4.17.20",
"teleport-javascript": "1.0.0", "teleport-javascript": "1.0.0",
"tough-cookie": "3.0.1", "tough-cookie": "3.0.1",
"uuid": "3.4.0", "uuid": "3.4.0",
"uvm": "1.7.8" "uvm": "1.7.9"
}, },
"dependencies": { "dependencies": {
"inherits": { "inherits": {
@ -3741,12 +3770,12 @@
} }
}, },
"postman-url-encoder": { "postman-url-encoder": {
"version": "2.1.1", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/postman-url-encoder/-/postman-url-encoder-2.1.1.tgz", "resolved": "https://registry.npmjs.org/postman-url-encoder/-/postman-url-encoder-2.1.3.tgz",
"integrity": "sha512-WxXvA3pWupcboNylMpBRO3U3aUmPP6kIftN9GtNOEoXiHWx5vuCHTSw1+eQDj4vHWe4UuwJYN3K0BLAqTsXi8w==", "integrity": "sha512-CwQjnoxaugCGeOyzVeZ4k1cNQ6iS8OBCzuWzcf4kLStKeRp0MwmLKYv25frynmDpugUUimq/d+FZCq6GtIX9Ag==",
"dev": true, "dev": true,
"requires": { "requires": {
"postman-collection": "^3.6.0", "postman-collection": "^3.6.4",
"punycode": "^2.1.1" "punycode": "^2.1.1"
} }
}, },
@ -4102,9 +4131,9 @@
"integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E="
}, },
"slug": { "slug": {
"version": "3.3.0", "version": "3.3.5",
"resolved": "https://registry.npmjs.org/slug/-/slug-3.3.0.tgz", "resolved": "https://registry.npmjs.org/slug/-/slug-3.3.5.tgz",
"integrity": "sha512-IbENbO0s6VFKWcjWmaNlb5HSvMSwqz0+IFg6G+dotpYptoY2n6+JcfP8dO2OxG8zyMlt9qTcCmMwBBdfsC1Kcw==" "integrity": "sha512-d/9yTbJDtSIhJThaNRP/U5uxwCl0mWIlV42JmKSfvg8t7DiVt69G8rAWTc0FWhaQOier0fiNAWVs7ctvVhK1RA=="
}, },
"source-map": { "source-map": {
"version": "0.6.1", "version": "0.6.1",
@ -4202,9 +4231,9 @@
} }
}, },
"strip-json-comments": { "strip-json-comments": {
"version": "3.1.0", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.0.tgz", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
"integrity": "sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
"dev": true "dev": true
}, },
"supports-color": { "supports-color": {
@ -4316,9 +4345,9 @@
} }
}, },
"uglify-js": { "uglify-js": {
"version": "3.10.0", "version": "3.11.0",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.10.0.tgz", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.11.0.tgz",
"integrity": "sha512-Esj5HG5WAyrLIdYU74Z3JdG2PxdIusvj6IWHMtlyESxc7kcDz7zYlYjpnSokn1UbpV0d/QX9fan7gkCNd/9BQA==", "integrity": "sha512-e1KQFRCpOxnrJsJVqDUCjURq+wXvIn7cK2sRAx9XL3HYLL9aezOP4Pb1+Y3/o693EPk111Yj2Q+IUXxcpHlygQ==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
@ -4340,9 +4369,9 @@
} }
}, },
"underscore": { "underscore": {
"version": "1.10.2", "version": "1.11.0",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.10.2.tgz", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.11.0.tgz",
"integrity": "sha512-N4P+Q/BuyuEKFJ43B9gYuOj4TQUHXX+j2FqguVOpjkssLUUrnJofCcBccJSCoeturDoZU6GorDTHSvUDlSQbTg==" "integrity": "sha512-xY96SsN3NA461qIRKZ/+qox37YXPtSBswMGfiNptr+wrt6ds4HaMw23TP612fEyGekRE6LNRiLYr/aqbHXNedw=="
}, },
"unique-string": { "unique-string": {
"version": "2.0.0", "version": "2.0.0",
@ -4477,14 +4506,14 @@
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
}, },
"uvm": { "uvm": {
"version": "1.7.8", "version": "1.7.9",
"resolved": "https://registry.npmjs.org/uvm/-/uvm-1.7.8.tgz", "resolved": "https://registry.npmjs.org/uvm/-/uvm-1.7.9.tgz",
"integrity": "sha512-Uasp7fsWQBo+pZbtlA0C464vYC6uHDdSVbX08vIinvi7r/k1R9sSs7n2/rf8lHkYRR6l4I46i7/xsWdqvLKDVQ==", "integrity": "sha512-Z3Uf7Jm8Cpvxf8FMjE7cFBaXsXzKu2n3kFqV23pQNLg8rrZqi6fmLFnLCn5EhiEC94XdcQCCNjrGeOnFdy1xsA==",
"dev": true, "dev": true,
"requires": { "requires": {
"flatted": "2.0.1", "flatted": "2.0.1",
"inherits": "2.0.4", "inherits": "2.0.4",
"lodash": "4.17.15", "lodash": "4.17.19",
"uuid": "3.3.2" "uuid": "3.3.2"
}, },
"dependencies": { "dependencies": {
@ -4494,6 +4523,12 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true "dev": true
}, },
"lodash": {
"version": "4.17.19",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
"dev": true
},
"uuid": { "uuid": {
"version": "3.3.2", "version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",

View file

@ -1,44 +1,42 @@
{ {
"name": "conduit-node", "name": "open-bike-sensor-web-api",
"version": "1.0.0", "version": "1.0.0",
"description": "conduit on node", "description": "Backend API for the OpenBikeSensor web app",
"main": "app.js", "main": "app.js",
"scripts": { "scripts": {
"mongo:start": "docker run --name realworld-mongo -p 27017:27017 mongo & sleep 5", "mongo:start": "docker run --name realworld-mongo -p 27017:27017 mongo & sleep 5",
"start": "node ./app.js", "start": "node ./app.js",
"dev": "nodemon ./app.js", "dev": "nodemon ./app.js",
"test": "newman run ./tests/api-tests.postman.json -e ./tests/env-api-tests.postman.json",
"stop": "lsof -ti :3000 | xargs kill",
"mongo:stop": "docker stop realworld-mongo && docker rm realworld-mongo" "mongo:stop": "docker stop realworld-mongo && docker rm realworld-mongo"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/gothinkster/productionready-node-api.git" "url": "git+https://github.com/Friends-of-OpenBikeSensor/obsAPI.git"
}, },
"license": "ISC", "license": "LGPLv3",
"dependencies": { "dependencies": {
"body-parser": "1.19.0", "body-parser": "1.19.0",
"cors": "2.8.5", "cors": "2.8.5",
"ejs": "3.1.3", "ejs": "^3.1.5",
"errorhandler": "1.5.1", "errorhandler": "1.5.1",
"express": "4.17.1", "express": "4.17.1",
"express-jwt": "5.3.3", "express-jwt": "^6.0.0",
"express-session": "1.17.1", "express-session": "1.17.1",
"jsonwebtoken": "8.5.1", "jsonwebtoken": "8.5.1",
"latest": "^0.2.0", "latest": "^0.2.0",
"method-override": "3.0.0", "method-override": "3.0.0",
"methods": "1.1.2", "methods": "1.1.2",
"mongoose": "5.9.20", "mongoose": "^5.10.7",
"mongoose-unique-validator": "2.0.3", "mongoose-unique-validator": "2.0.3",
"morgan": "1.10.0", "morgan": "1.10.0",
"passport": "0.4.1", "passport": "0.4.1",
"passport-local": "1.0.0", "passport-local": "1.0.0",
"request": "2.88.2", "request": "2.88.2",
"slug": "3.3.0", "slug": "^3.3.5",
"underscore": "1.10.2" "underscore": "^1.11.0"
}, },
"devDependencies": { "devDependencies": {
"newman": "^5.1.0", "newman": "^5.2.0",
"nodemon": "^2.0.4" "nodemon": "^2.0.4"
} }
} }

File diff suppressed because one or more lines are too long

View file

@ -1,9 +1,9 @@
var jwt = require('express-jwt'); var jwt = require('express-jwt');
var secret = require('../config').secret; var secret = require('../config').secret;
function getTokenFromHeader(req){ function getTokenFromHeader(req) {
if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Token' || if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Token' ||
req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') { req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
return req.headers.authorization.split(' ')[1]; return req.headers.authorization.split(' ')[1];
} }
@ -14,13 +14,15 @@ var auth = {
required: jwt({ required: jwt({
secret: secret, secret: secret,
userProperty: 'payload', userProperty: 'payload',
getToken: getTokenFromHeader getToken: getTokenFromHeader,
algorithms: ['HS256']
}), }),
optional: jwt({ optional: jwt({
secret: secret, secret: secret,
userProperty: 'payload', userProperty: 'payload',
credentialsRequired: false, credentialsRequired: false,
getToken: getTokenFromHeader getToken: getTokenFromHeader,
algorithms: ['HS256']
}) })
}; };

File diff suppressed because it is too large Load diff

View file

@ -1,14 +0,0 @@
{
"id": "4aa60b52-97fc-456d-4d4f-14a350e95dff",
"name": "Conduit API Tests - Environment",
"values": [{
"enabled": true,
"key": "apiUrl",
"value": "http://localhost:3000/api",
"type": "text"
}],
"timestamp": 1505871382668,
"_postman_variable_scope": "environment",
"_postman_exported_at": "2017-09-20T01:36:34.835Z",
"_postman_exported_using": "Postman/5.2.0"
}