An open API service indexing awesome lists of open source software.

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

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
```