{"id":22968465,"url":"https://github.com/parthipan-natkunam/fuber","last_synced_at":"2026-04-14T19:31:17.067Z","repository":{"id":128085263,"uuid":"135612687","full_name":"Parthipan-Natkunam/fuber","owner":"Parthipan-Natkunam","description":"A POC prototype code to simulate the RESTful APIs of an imaginary cab booking service","archived":false,"fork":false,"pushed_at":"2018-06-09T17:41:32.000Z","size":126,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-11T01:46:32.931Z","etag":null,"topics":["express-js","jade-template-engine","node-js","poc","restful-api","server-side-rendering"],"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/Parthipan-Natkunam.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":"2018-05-31T17:03:02.000Z","updated_at":"2018-06-09T17:43:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"d93c8195-daa4-45a1-917b-1eafc38c82ae","html_url":"https://github.com/Parthipan-Natkunam/fuber","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Parthipan-Natkunam/fuber","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Parthipan-Natkunam%2Ffuber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Parthipan-Natkunam%2Ffuber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Parthipan-Natkunam%2Ffuber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Parthipan-Natkunam%2Ffuber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Parthipan-Natkunam","download_url":"https://codeload.github.com/Parthipan-Natkunam/fuber/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Parthipan-Natkunam%2Ffuber/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31812968,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"ssl_error","status_checked_at":"2026-04-14T18:05:01.765Z","response_time":153,"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-js","jade-template-engine","node-js","poc","restful-api","server-side-rendering"],"created_at":"2024-12-14T21:19:24.483Z","updated_at":"2026-04-14T19:31:17.059Z","avatar_url":"https://github.com/Parthipan-Natkunam.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fuber\nA POC prototype code to simulate the RESTful APIs of an imaginary cab booking service\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"/reameImg/html.jpg\" alt=\"screenshot\"/\u003e\t\n\u003c/p\u003e\n\n## End of Ride Console Log:\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"/reameImg/console.jpg\" alt=\"console log\" /\u003e\n\u003c/p\u003e\n\t\n\n## Important Note:\nTo successfully run the project, it is advised to use node version ```8.11.2``` or greater\n\n## steps to run the project:\n1. Install the dependencies for the node server code\u003cbr/\u003e\n```cd fuber/server```\u003cbr/\u003e\n```npm install```\n\n2. To run the unit test \u003cbr/\u003e\n```npm test```\u003cbr/\u003e\nThe tests cases in the module assumes that all cabs are available at the start of the app. So it is advised to run this command first before running the app, if you are to run tests.\u003cbr/\u003e\n** Note: ** The API test Json file from Postman is in a folder within the tests folder\n\n3. To start the server\u003cbr/\u003e\n```npm start```\u003cbr/\u003e\n\nThe testing and API interactions were done through postman with raw JSON type in the request body.\n\n## Approach taken:\n1. The distance is calculated by using Pythogoras theorem to simplify for the purpose of POC.\n\u003cp align=\"center\"\u003e\n     \u003cimg src=\"/reameImg/distanceCalc.jpg\" alt=\"distance calc\"/\u003e \n \u003c/p\u003e\n \n2. The entire operation is modelled as a service.\n3. Restful APIs consume the service to provide required response on request.\n4. Request validators have been put in place using ```JOI``` module for ```POST```\nrequests.\n5. For maintaing a simplistic  POC approach, all data are held in memory.\n\n### Tech Stack:\n1. Node.js\n2. Express\n3. Jade (for server-side rendering of markup template)\n4. Postman (for API Testing)\n\n### API\n|Endpoint|type|request params|response|\n|--------|----|---------|------|\n|/|get|-|a list of available cab data|\n|/bookCab|post|id(userId),location,dropLocation,preferedColor|a ride object containing ride details or error|\n|/cancelCab|post|id(rideId)|success or error property|\n|/beginWait|post|id(rideId)|success or error property|\n|/beginRide|post|id(rideId)|success or error property|\n|/endRide|post|id(rideId)|total cost data for the ride or error |\n\n### Request, Response Sample:\n\n#### bookCab:\n##### request:\n```\n{\n\t\"id\": 1,\n\t\"loc\":{\n\t\t\"lat\": 4,\n\t\t\"long\": 3.6\t\n\t},\n\t\"dropLoc\":{\n\t\t\"lat\": 6,\n\t\t\"long\": 7.6\t\n\t},\n\t\"prefCol\": \"any\"\t\n}\n```\n\n##### Response:\n```\n{\n    \"id\": 3,\n    \"cabId\": 5,\n    \"cabIndex\": 4,\n    \"userLoc\": [\n        4,\n        3.6\n    ],\n    \"dropLoc\": [\n        6,\n        7.6\n    ]\n}\n```\n#### beginWait\n##### Request:\n```\n{\n\t\"id\": 3\n}\n```\n\n##### Response:\n```\n{\n    \"success\": \"Waiting time started\"\n}\n```\n\n#### beginRide\n##### Request:\n```\n{\n\t\"id\": 3\n}\n```\n\n##### Response\n```\n{\n    \"success\": \"ride has begun\"\n}\n```\n\n#### endRide\n##### Request:\n```\n{\n\t\"id\":4\n}\n```\n##### Response:\n```\n{\n    \"total\": 8.94,\n    \"travelCost\": 8.94,\n    \"waitingCost\": 0,\n    \"pinkFactor\": 0\n}\n```\n#### The root (/) API call to fetch all availble Cabs\nThis is a ```GET``` type request\nThe response for this request will be a server-side rendered HTML template showing available cabs with highlights for pink cabs.\n\n### Assumptions made:\n1. The cab cannot be cancelled once it has started waiting for the client or the ride is started.\n2. Can be cancelled before any of the above happens.\n3. All the distance unit is assumed to be in Km by default.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparthipan-natkunam%2Ffuber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparthipan-natkunam%2Ffuber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparthipan-natkunam%2Ffuber/lists"}