Base code for creating a Golang server/backend to quickly get started and build upon
- main.go: contains server configurations and starts the HTTP server
- Gorilla Mux router: for handling routes
- Route
'/status'
: to check status of the server - Middlewares:
- For all routes - enableCORS, logRequestWithDetails
- For desired routes - validateJWT
- Utilities:
- writeJSON - write response to browser
- errorJSON - write error response to browser
- wrapMiddlewares - wrap a route with one or more middleware functions
- Mongo: for establishing connection with a MongoDB server
- API: for writing api/graphql related functions that could be called from app/handlers.go
- Clone this repository
- Run:
go run cmd/main.go
PS: Note the TODOs