Skip to content

neelkumar01/webserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Go Web Server

image

This project is a minimal yet fully functional web server made from scratch in go programming language and this web server is built on top of golang's built-in "net/http" package

⭐️ Features

  • Dynamic route handling (/page1, /page2)
  • Static file serving (e.g., HTML, CSS, JS) from the public/ directory
  • Dynamic API proxying using a public API (catfact.ninja)
  • HTTPS support with self-signed certificates (cert.pem and key.pem) that enables TLS encryption
  • Web server works with http1.1 protocol

🧩 Quick Start

Prerequisites

  • Go 1.25.1+ installed
  • (Optional) run following command in terminal for generating local TLS certificates
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes

πŸ“¦ Clone and Run

git clone https://github.com/neelkumar01/webserver.git
cd webserver/myserver
go run main.go

πŸ“ Project Structure

webserver/
└── myserver/
    β”œβ”€β”€ public/                 # Static files directory
    β”‚   β”œβ”€β”€ about/              # Served at /about/
    β”‚   β”‚   β”œβ”€β”€ index.html
    β”‚   β”‚   └── style.css
    β”‚   └── root/               # Served at /
    β”‚       β”œβ”€β”€ index.html
    β”‚       └── style.css
    β”œβ”€β”€ cert.pem                # TLS certificate (for HTTPS)
    β”œβ”€β”€ key.pem                 # TLS private key
    β”œβ”€β”€ go.mod                  # Go module file
    └── main.go                 # Main application entry point

The server listens on port 9999 for https

https://localhost:9999/

πŸ—³οΈ Dependency Management

No external dependencies are used. All logic is built using Go's standard library:

  • net/http
  • fmt
  • io
  • log

About

Web server built in golang from scratch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published