{"id":21084335,"url":"https://github.com/ahmadhuss/express-api","last_synced_at":"2026-04-10T16:35:34.472Z","repository":{"id":48319565,"uuid":"391658841","full_name":"ahmadhuss/express-api","owner":"ahmadhuss","description":"An express API for the posts.","archived":false,"fork":false,"pushed_at":"2021-08-03T18:03:11.000Z","size":170,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-02T10:02:01.805Z","etag":null,"topics":["api","controller","express","mvc-pattern","nodejs","rest","rest-api"],"latest_commit_sha":null,"homepage":"https://express-rest-00.herokuapp.com/api/posts","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/ahmadhuss.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}},"created_at":"2021-08-01T15:03:36.000Z","updated_at":"2021-08-03T18:03:14.000Z","dependencies_parsed_at":"2022-08-19T03:20:57.213Z","dependency_job_id":null,"html_url":"https://github.com/ahmadhuss/express-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ahmadhuss/express-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadhuss%2Fexpress-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadhuss%2Fexpress-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadhuss%2Fexpress-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadhuss%2Fexpress-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahmadhuss","download_url":"https://codeload.github.com/ahmadhuss/express-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadhuss%2Fexpress-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265218750,"owners_count":23729528,"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":["api","controller","express","mvc-pattern","nodejs","rest","rest-api"],"created_at":"2024-11-19T20:24:00.627Z","updated_at":"2026-04-10T16:35:34.433Z","avatar_url":"https://github.com/ahmadhuss.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express RESTAPI\n\nThis project is implemented as a test for the Upwork Client. All `POST/PUT` endpoints also have data validation.\n\n## Use of the `.env` variables:\n\nTo use the .env variables please create the file (.env) at the root of your application.\n```  \nDATABASE_URL=connection://username:password@host:port/database\n```\n\nLocalhost:\n```  \nDATABASE_URL=postgres://postgres:a@localhost:5432/test\n```\n\nProduction:\n```  \nDATABASE_URL=postgres://534dc08d61a54a0e4c5f298@ec2-3-321-146-52.compute-1.amazonaws.com:5432/d4akfur43\n```\n\nYou can edit values according to your own database personal preference. I am using Postgres in this case.\n\n## Endpoints:\n\n#### 1:\n#### Method: `GET`\n#### Retrieve all posts:\n`https://express-rest-00.herokuapp.com/api/posts`\n\n#### Output:\n```\n{\n    \"response\": [\n        {\n            \"id\": 1,\n            \"text\": \"Hello World\",\n            \"slug\": \"hello-world\",\n            \"rating\": 4,\n            \"createdAt\": \"2021-08-01T21:27:51.958Z\",\n            \"updatedAt\": \"2021-08-01T21:27:51.960Z\"\n        },\n        {\n            \"id\": 2,\n            \"text\": \"Hello World 4\",\n            \"slug\": \"hello-world-4\",\n            \"rating\": 4,\n            \"createdAt\": \"2021-08-02T03:05:36.864Z\",\n            \"updatedAt\": \"2021-08-02T03:05:36.866Z\"\n        }\n    ]\n}\n```\n#### 2:\n#### Method: `GET`\n#### Retrieve single post:\n`https://express-rest-00.herokuapp.com/api/post/:id`\n\n`https://express-rest-00.herokuapp.com/api/post/1`\n\n#### Output:\n```\n{\n    \"response\": [\n        [\n            {\n                \"id\": 1,\n                \"text\": \"Hello World\",\n                \"slug\": \"hello-world\",\n                \"rating\": 4,\n                \"createdAt\": \"2021-08-01T17:30:02.555Z\",\n                \"updatedAt\": \"2021-08-01T17:30:02.556Z\"\n            }\n        ]\n    ]\n}\n```\n#### 3:\n#### Method: `POST`\n#### Add new post:\n`https://express-rest-00.herokuapp.com/api/post`\n\n### Body:\n\n```\n{  \n  text: 'This is post title',  \n  rating: 3  \n}\n```\n\n#### Output:\n```\n{\n    \"response\": {\n        \"saved\": true,\n        \"post\": {\n            \"createdAt\": \"2021-08-02T13:57:35.837Z\",\n            \"id\": 14,\n            \"text\": \"This is post title\",\n            \"slug\": \"this-is-post-title\",\n            \"rating\": 3,\n            \"updatedAt\": \"2021-08-02T13:57:35.839Z\"\n        }\n    }\n}\n```\n\n#### 4:\n#### Method: `PUT`\n#### Update the post:\n`https://express-rest-00.herokuapp.com/api/post/:id`\n\n`https://express-rest-00.herokuapp.com/api/post/1`\n\n### Body:\n\n```\n{  \n  text: 'This is Awesome',  \n  rating: 2  \n}\n```\n\n#### Output:\n```\n{\n    \"response\": {\n        \"updated\": true,\n        \"affected\": [\n            1,\n            [\n                {\n                    \"id\": 1,\n                    \"text\": \"This is Awesome\",\n                    \"slug\": \"this-is-awesome\",\n                    \"rating\": 2,\n                    \"createdAt\": \"2021-08-01T17:30:02.555Z\",\n                    \"updatedAt\": \"2021-08-02T14:01:49.690Z\"\n                }\n            ]\n        ]\n    }\n}\n```\n\n#### 5:\n#### Method: `DELETE`\n#### Remove the post:\n`https://express-rest-00.herokuapp.com/api/post/:id`\n\n`https://express-rest-00.herokuapp.com/api/post/1`\n\n#### Output:\n```\n{\n    \"response\": {\n        \"removed\": true\n    }\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmadhuss%2Fexpress-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmadhuss%2Fexpress-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmadhuss%2Fexpress-api/lists"}