Skip to content

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

Notifications You must be signed in to change notification settings

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages