{"id":17551040,"url":"https://github.com/ttu/sensordata-node-restapi","last_synced_at":"2026-04-15T10:37:46.601Z","repository":{"id":139968493,"uuid":"54729606","full_name":"ttu/sensordata-node-restapi","owner":"ttu","description":"Node Express REST API (ES2015 \u0026 ESnext) for cubesensors-iot-azure (https://github.com/ttu/cubesensors-iot-azure)","archived":false,"fork":false,"pushed_at":"2016-12-06T05:58:15.000Z","size":3162,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T07:29:32.345Z","etag":null,"topics":["express","nodejs","sql-server","sqlite","swagger"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ttu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-25T15:58:43.000Z","updated_at":"2017-06-07T18:46:08.000Z","dependencies_parsed_at":"2024-07-16T12:05:11.052Z","dependency_job_id":null,"html_url":"https://github.com/ttu/sensordata-node-restapi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ttu/sensordata-node-restapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttu%2Fsensordata-node-restapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttu%2Fsensordata-node-restapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttu%2Fsensordata-node-restapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttu%2Fsensordata-node-restapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttu","download_url":"https://codeload.github.com/ttu/sensordata-node-restapi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttu%2Fsensordata-node-restapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31837735,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T10:26:52.245Z","status":"ssl_error","status_checked_at":"2026-04-15T10:26:51.649Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express","nodejs","sql-server","sqlite","swagger"],"created_at":"2024-10-21T04:44:42.089Z","updated_at":"2026-04-15T10:37:46.584Z","avatar_url":"https://github.com/ttu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sensordata-node-restapi\n\nRest api for sensor data.\n\n### Development\n\n* unpack iot_db.7z (iot_db.sqlite) to root folder\n    * src/config.js has the path to development database\n\n```sh\n$ npm install\n$ npm run dev\n```\n\nSwagger UI: \u003chttp://localhost:8080/swagger/?url=http://localhost:8080/api_docs/swagger.yaml\u003e\n\n### Production\n\nProduction requires authentication. Supports local or http authentication. Authentication type (http/local) can be configured from src/config.js \n```sh\n# Http Authentication\ncurl -u admin:admin 127.0.0.1:8080/api/sensors\n# Local Authentication\n$ curl -d \"username=admin\u0026password=admin\" --dump-header headers 127.0.0.1:8080/api/login\n$ curl -L -b headers 127.0.0.1:8080/api/sensors\n```\n\n* Add keys.js file to src folder with correct parameters for production database and application login credentials\n\n```js\nexport default {\n    host          : '127.0.0.1',\n    user          : 'your_database_user',\n    password      : 'your_database_password',\n    database      : 'myapp_test',\n    loginUser     : 'admin',\n    loginPassword : 'admin'\n};\n```\n\n## Data\n\n```json\n[\n  {\n    \"SensorId\": \"000D6F0003141E14\",\n    \"MeasurementTime\": \"2015-10-29 10:23:00.0000000\",\n    \"Temperature\": 2115,\n    \"Pressure\": 1025,\n    \"Humidity\": 37,\n    \"Voc\": 400,\n    \"Light\": 69,\n    \"Noise\": 47,\n    \"Battery\": 80,\n    \"Cable\": 0,\n    \"VocResistance\": 146595,\n    \"Rssi\": -59\n  }\n]\n```\n## APIs\n\n```sh\n# Take specified data points for selected sensor\n$ curl \"localhost:8080/api/data/000D6F0003141E14?skip=0\u0026take=2\"\n# Take specified data points\n$ curl \"localhost:8080/api/data?skip=0\u0026take=2\"\n# Latest data point for each sensor\n$ curl \"localhost:8080/api/status\"\n# List of sensors\n$ curl \"localhost:8080/api/sensors\"\n# Average for specified field from last x minutes (latest data is from the beginning of 2016, so minutes must be high)\n$ curl \"localhost:8080/api/avg/Temperature/000D6F0003141E14?minutes=1440000\"\n# Room with sensor has people (100 yes, 0 no)\n$ curl \"localhost:8080/api/haspeople/000D6F0003141E14\"\n```\n\n## Azure deployment\n\n* Build (npm run build)\n* Update host from dist/api_docs/swagger.yaml\n```yaml\nhost: example.some.com\n```\n\n* Copy dist folder content to selected folder\n\n```sh\n# Install Azure CLI\n$ npm install -g azure-cli\n# Login to Azure\n$ azure config mode asm\n$ azure login\n# Create site\n$ azure site create --git {appname}\n# Update files\n$ git add .\n$ git commit -m \"first version\"\n$ git push azure master\n```\n\n* Turn on Web Sockets from Application Settings (go to portal.azure.com)\n\n## Swagger\n\nUse Online-editor to edit/validate yaml files: \u003chttp://editor.swagger.io/#/\u003e\n\n## Links\n\n#### Swagger\n* https://github.com/swagger-api/swagger-node\n* https://github.com/shawngong/Swagger-Node-Express-For-Existing-APIs\n* http://stackoverflow.com/questions/31300756/can-swagger-autogenerate-its-yaml-based-on-existing-express-routes\n\n#### Babel\n* https://github.com/babel/example-node-server\n* Mocha requires babel polyfill \u003chttps://babeljs.io/docs/usage/polyfill/\u003e\n* Runtime requires \u003chttps://babeljs.io/docs/plugins/transform-runtime/\u003e\n\n#### Express\n* https://github.com/passport/express-4.x-local-example/blob/master/server.js\n* https://github.com/developit/express-es6-rest-api\n* https://strongloop.com/strongblog/async-error-handling-expressjs-es7-promises-generators/\n\n#### Passport\n* https://github.com/jaredhanson/passport-local\n\n#### Knex\n* http://knexjs.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttu%2Fsensordata-node-restapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttu%2Fsensordata-node-restapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttu%2Fsensordata-node-restapi/lists"}