Coder Social home page Coder Social logo

go-socket-http-server's Introduction

Simple Web server in Go

in order to solve Computer assignment of Computer Networks in SBU (Spring 1400) I implemented a web server in Go

more info about project could be found here

this web server can only handle one specific request: request for a file in file system

for example:

curl -v 127.0.0.1/index.html

how to use

this program is written in pure go, so for compilation you need to install go>=1.16

after that that would be enough to run:

# compile and run 
go build 
sudo ./http-server

# just run
go run main.go
important note

don't forgot to use sudo because opening port 80 needs root access, of you are a normal user you can setup server on another port with this command:

go build 
./http-server -port 8080
# or
go run main.go -port 8080

how to use

after running on port 80,

  • just open browser and visit localhost
  • add your files to static folder, for example add music.mp3 to static folder and view it in address localhost/music.mp3
  • if you want to use curl or another friends, yo can see requests.sh file.

Implementation details

you can read about details of implementation in report.md

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.