{"id":20696886,"url":"https://github.com/araobp/api-server","last_synced_at":"2026-04-13T14:32:35.737Z","repository":{"id":145718900,"uuid":"115668722","full_name":"araobp/api-server","owner":"araobp","description":"Simple API server for managing taxi drivers","archived":false,"fork":false,"pushed_at":"2018-01-13T22:35:57.000Z","size":239,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-11T02:48:32.407Z","etag":null,"topics":["express","mongodb","mongoose","nodejs","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/araobp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-12-28T23:56:09.000Z","updated_at":"2017-12-31T11:21:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"e05a9dca-8841-4c83-bf70-11f518022423","html_url":"https://github.com/araobp/api-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/araobp/api-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fapi-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fapi-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fapi-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fapi-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/araobp","download_url":"https://codeload.github.com/araobp/api-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fapi-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31757477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T13:27:56.013Z","status":"ssl_error","status_checked_at":"2026-04-13T13:21:23.512Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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","mongodb","mongoose","nodejs","rest-api"],"created_at":"2024-11-17T00:15:48.408Z","updated_at":"2026-04-13T14:32:35.719Z","avatar_url":"https://github.com/araobp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# REST API server for managing taxi drivers\n\n## Motivation\n\nI sometimes use taxi. I have noticed that taxi drivers are aging. They require health monitoring even during driving taxi.\n\n## Sensor network for managing taxi drivers\n\n```\n [Driver]---[sensor]---[taxi]---wireless connectivity---[API server][MongoDB]\n  name      deviceId   CarId                                 |\n                                                             +------[Management client]\n```\n\nExample of sensor devices:\n- Driver authentication sensor (e.g., fingerprint authentication)\n- Driver health monitoring (e.g., doppler sensor for sensing heat beat etc)\n- Taxi tracking (GPS)\n\nIn the first release, the API server supports driver authentication sensor only.\n\n## Architecture\n\nSystem:\n![vpn](./doc/vpn.jpg)\n\n[OpenVPN setup tips](./doc/openvpn.md)\n\nAPI Server:\n```\n    --- REST --- [[app.js]--[db.js(mongoose-based)]--[MongoDB]]\n```\n## Implementation\n\n- [API Server](./server)\n- [Unit test(API client)](./unittest)\n\n## Schema (data model)\n\n```\nvar driversSchema = mongoose.Schema({\n  name: {type: String, unique: true},\n  deviceId: String,\n  carId: String,\n  result: String,\n  timestamp: Number\n});\n\nvar syncSchema = mongoose.Schema({\n  type: {type: String, unique: true},\n  data: String,\n  timestamp: Number\n});\n```\n\n## REST API spec\n\n### TAXI DRIVER STATUS MANAGEMENT\n\n#### PUT /drivers/{name}\n```\nPUT /drivers/{name}\nCreate/update driver status\n```\nRequest body (PUT)\n\n|Name        |type   |Description                                   |\n|------------|-------|----------------------------------------------|\n|deviceId    |String |Authentication device ID                      |\n|carId       |String |Vehicle ID                                    |\n|result      |String |Authentication result: \"SUCCESS\" or \"FAILURE\" |\n\nExample\n```\nPUT /drivers/Michael\n{\n  \"deviceId\": \"device1\",\n  \"carId\": \"taxi1\",\n  \"result\": \"SUCCESS\"\n}\n```\n\n#### GET /drivers/{name}\n```\nGET /drivers/{name}\nShow driver status details\n```\nResponse body (200 OK)\n\n|Name        |type   |Description                                   |\n|------------|-------|----------------------------------------------|\n|name        |String |Driver name                                   |\n|deviceId    |String |Authentication device ID                      |\n|carId       |String |Vehicle ID                                    |\n|result      |String |Authentication result: \"SUCCESS\" or \"FAILURE\" |\n|timestamp   |Number |Epoch time (aka Unix time) at the last PUT    |\n\nNote: For example, epoch time can be obtained by typing the following command on Linux: \n```\npi@raspberrypi:~ $ date +%s\n1514509935\n```\n\nExample\n```\nGET /driviers/Michael\n{\n  \"name\": \"Michael\",\n  \"deviceId\": \"device1\",\n  \"carId\": \"taxi1\",\n  \"result\": \"SUCCESS\",\n  \"timestamp\": 1514509809\n}\n```\n\n#### GET /drivers\n```\nGET /drivers\nList driver names\n```\nResponse body (200 OK)\n\nList of driver name and timestamp at the last PUT.\n\nExample\n```\n{\n  \"Jacob\": {\"timestamp\": 1514509472},\n  \"Michael\": {\"timestamp\": 1514509359},\n  \"Joshua\": {\"timestamp\": 1514509127}\n}\n```\n\n#### DELETE /drivers/{name}\n```\nDELETE /drivers/{name}\nDelete driver\n```\n\n### TAXI STATUS MANAGEMENT\n\nThis operation is the heart of the API service.\n\n#### GET /taxies\n```\nGET /taxies\nList taxies and their drivers\n```\nResponse body (200 OK)\n\nList of driver name and timestamp at the last PUT\n\nExample\n```\n{\n  \"taxi1\": {\"name\": \"Jacob\", \"result\": \"SUCCESS\", \"timestamp\": 1514509472},\n  \"taxi2\": {\"name\": \"Michael\", \"result\": \"SUCCESS\", \"timestamp\": 1514509359},\n  \"taxi3\": {\"name\": \"Joshua\", \"result\": \"FAILURE\", \"timestamp\": 1514509127}\n}\n```\n\n### BINARY DATA SYNCHRONIZATION\n\n#### PUT /sync/registration\n```\nPUT /sync/registration\nUpload binary data to be shared by other vehicles\n```\nRequest body (PUT)\n\n|Name        |type   |Description                                   |\n|------------|-------|----------------------------------------------|\n|data        |String |Binary data encoded in BASE64                 |\n\nExample\n```\n{\n  \"data\": \"\u003cbase64-encoded binary data\u003e\n}\n```\n\n#### GET /sync/registration\n```\nGET /sync/registration\nDownload binary data\n```\nResponse body (200 OK)\n\n|Name        |type   |Description                                   |\n|------------|-------|----------------------------------------------|\n|data        |String |Binary data encoded in BASE64                 |\n|timestamp   |String |Epoch time (aka Unix time)                    |\n\nExample\n```\n{\n  \"data\": \"\u003cbase64-encoded binary data\u003e\",\n  \"timestamp\": 1514509935\n}\n```\n\n#### GET /sync/registration/timestamp\n```\nGET /sync/registration/timestamp\nShow time at the latest upload\n```\n|Name        |type   |Description                                   |\n|------------|-------|----------------------------------------------|\n|timestamp   |String |Epoch time (aka Unix time)                    |\n\nExample\n```\n{\n  \"timestamp\": 1514509935\n}\n```\n\n### DATABASE MANAGEMENT\n```\nPOST /db/drop\nDrop database\n```\n\n## Mongoose data schema structure\n\n```\ntaxi\n  |\n  +-- Drivers\n  |\n  +-- Sync\n```\n\nFor exaple, on mongo CLI,\n```\n\u003e use taxi\n\u003e db.Drivers.find()\n{ \"_id\" : ObjectId(\"5a46cf55c9b85847f010d1ed\"), \"name\" : \"driver1\", \"__v\" : 0, \"timestamp\" : 1514593114, \"result\" : \"SUCCESS\", \"carId\" : \"taxi3\", \"deviceId\" : \"device3\" }\n```\n\n## TODO\n\n- Support change notifications: MQTT over WebSocket.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faraobp%2Fapi-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faraobp%2Fapi-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faraobp%2Fapi-server/lists"}