Skip to content

RafsanNeloy/go_Application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample Go/Web Server

A simple Go web server demonstrating basic HTTP routing, middleware, and graceful shutdown using Gorilla Mux and Logrus.


🚀 Getting Started

Open Using Daytona

  1. Install Daytona: Follow the Daytona installation guide.
  2. Create the Workspace:
    daytona create https://github.com/RafsanNeloy/go_Application.git
  3. Install Dependencies:
    go mod tidy
  4. Start the Application:
    go run main.go

✨ Features

  • Simple HTTP server with two routes
  • Structured logging with Logrus
  • Middleware for request logging
  • Panic recovery middleware
  • Graceful server shutdown
  • Environment variable-based port configuration

🛠️ Project Structure

  • main.go: Primary application file with server logic
  • go.mod: Go module dependency management

🔧 Dependencies


Using Postman/Insomnia

  1. Plain Text Endpoint:
    • Set method to GET
    • Enter URL: http://localhost:8080/
    • Expected Response:
  Hello, World!
  1. JSON Endpoint:
    • Set method to GET
    • Enter URL: http://localhost:8080/json
    • Expected Response:
  {
    "message": "Hello, JSON World!"
  }

📡 Endpoints

  • GET /: Returns a plain text "Hello, World!" message
  • GET /json: Returns a JSON response

🌐 Configuration

Configure the server port using the PORT environment variable. Defaults to 8080 if not specified.

About

a simple Go web server using Gorilla Mux and Logrus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages