{"id":18878314,"url":"https://github.com/captaincluster/timestamp-microservice","last_synced_at":"2025-04-14T18:32:11.707Z","repository":{"id":238313131,"uuid":"796297349","full_name":"CaptainCluster/Timestamp-Microservice","owner":"CaptainCluster","description":"The first project for the \"Back End Development and APIs\" course provided by FreeCodeCamp.","archived":true,"fork":false,"pushed_at":"2024-05-05T15:06:23.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-20T12:47:03.801Z","etag":null,"topics":["backend","expressjs","freecodecamp","freecodecamp-project","microservice"],"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/CaptainCluster.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":"2024-05-05T14:33:52.000Z","updated_at":"2024-09-26T07:24:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"6483c665-dd8d-400c-b963-d7463c02ac76","html_url":"https://github.com/CaptainCluster/Timestamp-Microservice","commit_stats":null,"previous_names":["captaincluster/timestamp-microservice"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptainCluster%2FTimestamp-Microservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptainCluster%2FTimestamp-Microservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptainCluster%2FTimestamp-Microservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CaptainCluster%2FTimestamp-Microservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CaptainCluster","download_url":"https://codeload.github.com/CaptainCluster/Timestamp-Microservice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248936857,"owners_count":21186115,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["backend","expressjs","freecodecamp","freecodecamp-project","microservice"],"created_at":"2024-11-08T06:25:53.472Z","updated_at":"2025-04-14T18:32:11.701Z","avatar_url":"https://github.com/CaptainCluster.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Timestamp Microservice\n\n![Express.js](https://img.shields.io/badge/express.js-%23404d59.svg?style=for-the-badge\u0026logo=express\u0026logoColor=%2361DAFB)\n\nTimestamp Microservice is a simple **ExpressJS** project for the FreeCodeCamp course **Back End Development and APIs**. The user gives a date as a parameter in a request and receives a JSON file with the date in **unix** and **utc** formats. \n\n🙏 Credits\n---\n![FreeCodeCamp](https://img.shields.io/badge/Freecodecamp-%23123.svg?\u0026style=for-the-badge\u0026logo=freecodecamp\u0026logoColor=green)\n\nEverything not written by me has been cloned from [this GitHub repository](https://github.com/freeCodeCamp/boilerplate-project-timestamp/).\n\nHere is the solution I wrote for this project:\n```\napp.get(\"/api/:date\", function(req, res)\n{\n  let date = req.params.date;\n  //Unix type can be recognized as' a number\n  if(!isNaN(Number(date)))\n  {\n    return res.json({\n      unix: Number(date),\n      utc: new Date(Number(date)).toUTCString()\n    });\n  }\n\n  // If the date is not in numeric form, it is expected to be of\n  // type string. Checking whether it is valid or not...\n  if(new Date(date).toUTCString() == \"Invalid Date\")\n  {\n    return res.json({\n      error: \"Invalid Date\"\n    });\n  }\n\n  // A valid string date will be handled now, as an invalid one\n  // would have triggered a return command.\n  return res.json({\n    unix: new Date(date).getTime(),\n    utc: new Date(date).toUTCString()\n  });\n\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaptaincluster%2Ftimestamp-microservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaptaincluster%2Ftimestamp-microservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaptaincluster%2Ftimestamp-microservice/lists"}