Skip to content

Syed007Hassan/GO-With-PostgreSQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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://<username>:<password>@localhost:5432/<db_name>?sslmode=disable"
  • To run:
go run main.go

About

Implemented REST APIs that perform CRUD operations with PostgreSQL

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages