{"id":22690057,"url":"https://github.com/alexxgmz/go-rest-server","last_synced_at":"2026-04-28T22:31:32.252Z","repository":{"id":245124111,"uuid":"814585501","full_name":"alexxGmZ/go-rest-server","owner":"alexxGmZ","description":"A Go TODO REST server","archived":false,"fork":false,"pushed_at":"2025-04-22T03:22:34.000Z","size":17863,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-22T05:46:34.339Z","etag":null,"topics":["go","postgresql","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexxGmZ.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":"2024-06-13T09:46:34.000Z","updated_at":"2025-04-22T03:22:37.000Z","dependencies_parsed_at":"2024-07-22T13:19:13.600Z","dependency_job_id":"b201b120-ec69-4da2-a716-a52d8e4d1232","html_url":"https://github.com/alexxGmZ/go-rest-server","commit_stats":null,"previous_names":["alexxgmz/go-rest-server"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/alexxGmZ/go-rest-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexxGmZ%2Fgo-rest-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexxGmZ%2Fgo-rest-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexxGmZ%2Fgo-rest-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexxGmZ%2Fgo-rest-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexxGmZ","download_url":"https://codeload.github.com/alexxGmZ/go-rest-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexxGmZ%2Fgo-rest-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32402666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"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":["go","postgresql","rest-api"],"created_at":"2024-12-10T00:25:27.444Z","updated_at":"2026-04-28T22:31:32.238Z","avatar_url":"https://github.com/alexxGmZ.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go REST Server\n\nLearning Go by building a TODO REST server with PostgreSql.\n\n\u003cbr\u003e\n\n## Database\n\n**db name:** go_todo\n\ntable/s:\n\n```sql\nCREATE TABLE Tasks (\n  task_id SERIAL,\n  description TEXT NOT NULL,\n  status VARCHAR(40) DEFAULT 'On-going',\n  deadline TIMESTAMP,\n  date_added TIMESTAMP DEFAULT NOW(),\n  archive BOOLEAN DEFAULT FALSE,\n  PRIMARY KEY (task_id)\n);\n```\n\n\u003cbr\u003e\n\n## Environment Variable/s\n\n* `POSTGRESURL` - database URL.\n  - example: `postgresql://user:password@host/db_name`\n* `PORT` - Server Port.\n\n\u003cbr\u003e\n\n## Endpoints\n\n### GET /task/:taskId\n\nRetrieves a task from the database by its ID, provided it is not archived.\nRequires the \"**taskId**\" parameter in the endpoint. It responds with the task details\nin JSON format or an error message if the task is not found or if there is a failure\nin querying the database.\n\n**Response:**\n\nStatusOk\n```json\n{\n  \"task_id\": 8,\n  \"description\": \"Feed the pets\",\n  \"status\": \"On-going\",\n  \"deadline\": \"2024-09-08T00:00:00Z\",\n  \"date_added\": \"2024-06-29T19:03:00.226263Z\"\n}\n```\n\nStatusNotFound\n```json\n{ \"message\": \"Task not found\" }\n```\n\nStatusInternalServerError\n```json\n{\n  \"message\": \"Failed to query task\",\n  \"error\":   \"Error object\",\n}\n```\n\n\u003cbr\u003e\n\n### GET /tasks/all\n\nRetrieves a list of tasks from the database where the deadline is in the future.\nIt responds with a JSON array of tasks or an error message in case of a failure.\n\n**Response:**\n\nStatusOk\n```json\n[\n  {\n    \"task_id\": 6,\n    \"description\": \"Another Task\",\n    \"status\": \"On-going\",\n    \"deadline\": \"2024-12-25T00:00:00Z\",\n    \"date_added\": \"2024-06-29T12:54:54.404224Z\"\n  },\n  {\n    \"task_id\": 7,\n    \"description\": \"Another Task\",\n    \"status\": \"On-going\",\n    \"deadline\": \"2024-12-25T00:00:00Z\",\n    \"date_added\": \"2024-06-29T19:02:02.769241Z\"\n  },\n  {\n    \"task_id\": 8,\n    \"description\": \"Feed the pets\",\n    \"status\": \"On-going\",\n    \"deadline\": \"2024-09-08T00:00:00Z\",\n    \"date_added\": \"2024-06-29T19:03:00.226263Z\"\n  }\n]\n```\n\nStatusInternalServerError\n```json\n{\n  \"message\": \"Failed to query task\",\n  \"error\":   \"Error object\",\n}\n```\n\n\u003cbr\u003e\n\n### GET /tasks/archived\n\nRetrieves a list of archived tasks from the database. It responds with a JSON array\nof archived tasks or an error message in case of a failure.\n\n**Response:**\n\nStatusOk\n```json\n[\n  {\n    \"task_id\": 1,\n    \"description\": \"Task 1\",\n    \"status\": \"Done\",\n    \"deadline\": \"2024-06-24T12:00:00Z\",\n    \"date_added\": \"2024-06-14T16:27:25.941532Z\"\n  },\n  {\n    \"task_id\": 2,\n    \"description\": \"Task 2\",\n    \"status\": \"Done\",\n    \"deadline\": \"2024-06-26T12:00:00Z\",\n    \"date_added\": \"2024-06-14T16:27:25.941532Z\"\n  },\n  {\n    \"task_id\": 3,\n    \"description\": \"Task 3\",\n    \"status\": \"Done\",\n    \"deadline\": \"2024-12-25T00:00:00Z\",\n    \"date_added\": \"2024-06-23T14:43:56.601526Z\"\n  }\n]\n```\n\nStatusInternalServerError\n```json\n{\n  \"message\": \"Failed to query task\",\n  \"error\":   \"Error object\",\n}\n```\n\n\u003cbr\u003e\n\n### GET /tasks/count\n\nCounts all active tasks in the database where the deadline is in the future and the\ntask is not archived. Responds with the task count or an error message in case of a\nfailure.\n\n**Response:**\n\nStatusOk\n```\n[Integer]\n```\n\nStatusInternalServerError\n```json\n{\n  \"message\": \"Failed to query task\",\n  \"error\":   \"Error object\",\n}\n```\n\n\u003cbr\u003e\n\n### GET /tasks/late\n\nRetrieves a list of tasks from the database where the deadline has already passed.\nIt responds with a JSON array of late tasks or an error message in case of a failure.\n\n**Response:**\n\nStatusOk\n```json\n[\n  {\n    \"task_id\": 9,\n    \"description\": \"love them all\",\n    \"status\": \"On-going\",\n    \"deadline\": \"2024-02-14T00:00:00Z\",\n    \"date_added\": \"2024-06-29T19:03:20.884892Z\"\n  }\n]\n```\n\nStatusInternalServerError\n```json\n{\n  \"message\": \"Failed to query task\",\n  \"error\":   \"Error object\",\n}\n```\n\n\u003cbr\u003e\n\n### GET /tasks/late/count\n\nCounts all late tasks in the database where the deadline has passed and the task\nis not archived. Responds with the count of late tasks or an error message in case of a\nfailure.\n\n**Response:**\n\nStatusOk\n```\n[Integer]\n```\n\nStatusInternalServerError\n```json\n{\n  \"message\": \"Failed to query task\",\n  \"error\":   \"Error object\",\n}\n```\n\n\u003cbr\u003e\n\n### DELETE /task/:taskId\n\nDeletes a task from the database by its ID. Requires the \"**taskId**\" parameter in the\nendpoint. It responds with a success message or an error message in case of a failure.\n\n**Response:**\n\nStatusOk\n```json\n{ \"message\": \"Task deleted successfully\" }\n```\n\nStatusNotFound\n```json\n{ \"message\": \"Task not found\" }\n```\n\nStatusInternalServerError\n```json\n{\n  \"message\": \"Failed to convert int to string\",\n  \"error\":   \"Error object\",\n}\n```\n```json\n{\n  \"message\": \"Failed to delete task\",\n  \"error\":   \"Error object\",\n}\n```\n\n\u003cbr\u003e\n\n### PATCH /task/done/:taskId\n\nMarks a task as done and archives it in the database by its ID.\nRequires the \"**taskId**\" parameter in the endpoint. It responds with a success message\nor an error message in case of a failure.\n\n**Response:**\n\nStatusOk\n```json\n{ \"message\": \"Task archived successfully\" }\n```\n\nStatusNotFound\n```json\n{ \"message\": \"Task not found\" }\n```\n\nStatusInternalServerError\n```json\n{\n  \"message\": \"Failed to convert int to string\",\n  \"error\":   \"Error object\",\n}\n```\n```json\n{\n  \"message\": \"Failed to archive task\",\n  \"error\":   \"Error object\",\n}\n```\n\n\u003cbr\u003e\n\n### PATCH /task/archive/:taskId\n\nArchives a task in the database by its ID. Requires the \"**taskId**\" parameter in the\nendpoint. It responds with a success message or an error message in case of a failure.\n\n**Response:**\n\nStatusOk\n```json\n{ \"message\": \"Task archived successfully\" }\n```\n\nStatusNotFound\n```json\n{ \"message\": \"Task not found\" }\n```\n\nStatusInternalServerError\n```json\n{\n  \"message\": \"Failed to convert int to string\",\n  \"error\":   \"Error object\",\n}\n```\n```json\n{\n  \"message\": \"Failed to archive task\",\n  \"error\":   \"Error object\",\n}\n```\n\n\u003cbr\u003e\n\n### PATCH /task/unarchive/:taskId\n\nUnarchives a task in the database by its ID. Requires the \"**taskId**\" parameter in the\nendpoint. It responds with a success message or an error message in case of a failure.\n\n**Response:**\n\nStatusOk\n```json\n{ \"message\": \"Task unarchived successfully\" }\n```\n\nStatusNotFound\n```json\n{ \"message\": \"Task not found\" }\n```\n\nStatusInternalServerError\n```json\n{\n  \"message\": \"Failed to convert int to string\",\n  \"error\":   \"Error object\",\n}\n```\n```json\n{\n  \"message\": \"Failed to unarchive task\",\n  \"error\":   \"Error object\",\n}\n```\n\n\u003cbr\u003e\n\n### POST /create\n\nCreates a new task in the database. It responds with a success message or an error message\nin case of a failure.\n\n**Request:**\n\n```json\n{\n  \"description\": \"\",\n  \"deadline\": \"\"\n}\n```\n\n**Response:**\n\nStatusOk\n```json\n{ \"message\": \"Task created successfully\" }\n```\n\nStatusInternalServerError\n```json\n{\n  \"message\": \"Failed to bind JSON\",\n  \"error\":   \"Error object\",\n}\n```\n```json\n{\n  \"message\": \"Failed to create task\",\n  \"error\":   \"Error object\",\n}\n```\n\n\u003cbr\u003e\n\n### PUT /task/update\n\nUpdates a specific task in the database based on the provided JSON request format.\nThe task to update is identified implicitly from the context of the request body.\nResponds with a success message or an error message in case of a failure.\n\n**Request:**\n\n```json\n{\n  \"task_id\": 10,\n  \"description\": \"new year\",\n  \"deadline\": \"2024-01-01\"\n}\n```\n\n**Response:**\n\nStatusOk\n```json\n{ \"message\": \"Task updated successfully\" }\n```\n\nStatusNotFound\n```json\n{ \"message\": \"Task not found\" }\n```\n\nStatusInternalServerError\n```json\n{\n  \"message\": \"Failed to bind JSON\",\n  \"error\":   \"Error object\",\n}\n```\n```json\n{\n  \"message\": \"Failed to update task\",\n  \"error\":   \"Error object\",\n}\n```\n\u003cbr\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexxgmz%2Fgo-rest-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexxgmz%2Fgo-rest-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexxgmz%2Fgo-rest-server/lists"}