{"id":20019600,"url":"https://github.com/contawo/golang-rest-api-postgres","last_synced_at":"2026-04-20T14:31:15.303Z","repository":{"id":181907650,"uuid":"667615074","full_name":"contawo/golang-rest-api-postgres","owner":"contawo","description":"Here I was learning how to use the go-lang to create rest api's. The best way to learn is by creating projects. For the frontend I used python to request to test the api.","archived":false,"fork":false,"pushed_at":"2023-07-18T02:51:56.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T03:28:39.645Z","etag":null,"topics":["golang","http-requests","python3","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/contawo.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}},"created_at":"2023-07-17T23:27:58.000Z","updated_at":"2024-03-27T13:02:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"549af8dd-a4d8-45a8-bf02-65ff22b9e560","html_url":"https://github.com/contawo/golang-rest-api-postgres","commit_stats":null,"previous_names":["awonke11/golang-rest-api-postgres","contawo/golang-rest-api-postgres"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/contawo/golang-rest-api-postgres","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contawo%2Fgolang-rest-api-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contawo%2Fgolang-rest-api-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contawo%2Fgolang-rest-api-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contawo%2Fgolang-rest-api-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/contawo","download_url":"https://codeload.github.com/contawo/golang-rest-api-postgres/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contawo%2Fgolang-rest-api-postgres/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32050873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["golang","http-requests","python3","rest-api"],"created_at":"2024-11-13T08:28:05.932Z","updated_at":"2026-04-20T14:31:15.284Z","avatar_url":"https://github.com/contawo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Golang Rest API with Python\n![Golang image from the internet](https://miro.medium.com/v2/resize:fit:920/1*CdjOgfolLt_GNJYBzI-1QQ.jpeg)\n\nA Golang Rest API project with Postgres as the Database. Used Python \n```requests``` \nto fetch the data from the API.\n\n### Requirements to get started\n1. You must have \u003ca href=\"https://go.dev/doc/install\"\u003eGolang installed\u003c/a\u003e in your system.\n2. You must also have \u003ca href=\"https://www.python.org/downloads/\"\u003ePython installed\u003c/a\u003e in your system as well.\n3. Lastly, you will need to have \u003ca href=\"https://www.postgresql.org/download/\"\u003ePostgreSQL installed\u003c/a\u003e\n\n### Project Setup\n- \u003ca href=\"https://www.freecodecamp.org/news/how-to-fork-a-github-repository/#:~:text=To%20follow%20along%2C%20browse%20to,created%20under%20your%20GitHub%20account.\"\u003eFork this repo\u003c/a\u003e into your own Github\n- Then clone the repo into your system\n    ```git clone url \u003cdirectory\u003e```\n- Run the following command on the terminal:\n    ```go mod init [module-name]```\n- Followed by this command which will install all the golang dependencies: ```go mod tidy```\n- Create a ```.env``` file on the main folder and add the following code with your details:\n    ```env\n    DB_HOST=127.0.0.1\n    DB_PORT=5432\n    DB_PASSWORD=[your password]\n    DB_USER=[username]\n    DB_NAME=[database name]\n    DB_SSLMODE=disable\n    ```\n- Run the following command in your terminal:\n    ```terminal\n    python3 -m pip install requests\n    ```\n\n### Postgres Setup\n- Run the following commands on your postgres terminal/admin\n    ```sql\n    CREATE TABLE users (\n        user_id numeric(10, 0) NOT NULL,\n        name character varying(50) COLLATE pg_catalog.\"default\" NOT NULL,\n        age numeric(3, 0) NOT NULL,\n        phone character varying(20) COLLATE pg_catalog.\"default\",\n        CONSTRAINT user_table_pkey PRIMARY KEY (user_id)\n    );\n\n    INSERT INTO users (user_id, name, age, phone) VALUES (3, 'Jenny', 34, NULL);\n    INSERT INTO users (user_id, name, age, phone) VALUES (2, 'Tom', 29, '1 800 123 1234');\n    INSERT INTO users (user_id, name, age, phone) VALUES (1, 'John', 28, NULL);\n    ```\n\u003e I am using vscode as my code editor. \u003ca href=\"https://youtu.be/ezjoDYs72GA\"\u003eWatch\u003c/a\u003e to connect postgres to vscode\n\n### Running the project\n\u003eYou need to open two terminals, one for the server and the other for the request.\n\n#### On the server terminal\n\u003e Make sure you are on the main directory of the project\n- Run the following commmand\n    ```terminal\n    go run main.go\n    ```\n- This should open up something like this on the terminal\n    ![Alt text](image.png)\n\n#### On the request terminal\n- Run the following command\n    ```terminal\n    cd frontend\n    python3 main.py\n    ```\n- Then you shall see your data in a ```json``` format\n\n**Feel free to log any issues you have or become a contributer to the project**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontawo%2Fgolang-rest-api-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontawo%2Fgolang-rest-api-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontawo%2Fgolang-rest-api-postgres/lists"}