https://github.com/syed007hassan/go-with-postgresql
Implemented REST APIs that perform CRUD operations with PostgreSQL
https://github.com/syed007hassan/go-with-postgresql
golang postgresql rest-api
Last synced: 5 months ago
JSON representation
Implemented REST APIs that perform CRUD operations with PostgreSQL
- Host: GitHub
- URL: https://github.com/syed007hassan/go-with-postgresql
- Owner: Syed007Hassan
- Created: 2023-03-10T12:18:44.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-11T07:47:52.000Z (over 2 years ago)
- Last Synced: 2025-02-17T21:46:33.389Z (8 months ago)
- Topics: golang, postgresql, rest-api
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GO-With-PostgresSQL
* Implemented REST APIs that perform CRUD operations with PostgreSQL
```
router.HandleFunc("/api/stock/{id}", middleware.GetStock).Methods("GET", "OPTIONS")
router.HandleFunc("/api/stock", middleware.GetAllStocks).Methods("GET", "OPTIONS")
router.HandleFunc("/api/newstock", middleware.CreateStock).Methods("POST", "OPTIONS")
router.HandleFunc("/api/stock/{id}", middleware.UpdateStock).Methods("PUT", "OPTIONS")
router.HandleFunc("/api/deletestock/{id}", middleware.DeleteStock).Methods("DELETE", "OPTIONS")
```
* To configure DB connection use:
```
POSTGRES_URL="postgres://:@localhost:5432/?sslmode=disable"
```* To run:
```
go run main.go
```