ABHINAV-SUREKA / go-backend-server-base-code

Base code for a Golang server to quickly get started and build upon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-backend-server-base-code

Description:

Base code for creating a Golang server/backend to quickly get started and build upon

Items already included:

  1. main.go: contains server configurations and starts the HTTP server
  2. Gorilla Mux router: for handling routes
  3. Route '/status': to check status of the server
  4. Middlewares:
    1. For all routes - enableCORS, logRequestWithDetails
    2. For desired routes - validateJWT
  5. Utilities:
    1. writeJSON - write response to browser
    2. errorJSON - write error response to browser
    3. wrapMiddlewares - wrap a route with one or more middleware functions
  6. Mongo: for establishing connection with a MongoDB server
  7. API: for writing api/graphql related functions that could be called from app/handlers.go

Steps to run the server:

  1. Clone this repository
  2. Run: go run cmd/main.go

PS: Note the TODOs

About

Base code for a Golang server to quickly get started and build upon


Languages

Language:Go 100.0%