Posts

Home File Server on Golang

Home File server is a system which host files on your computer, on the local network (Wifi) and other devices on the same network can access those file by following the URL This post will help you build the file server from scratch. So lets get started First create a directory which will have your project In this directory create a folder and name it as publicFolder. This folder will contain all the files to be hosted to the local network Now, create a file (and name it lets say ubuntuserver.go).  Now Include the following imports in your go file (ubuntuserver.go) Import File "fmt" : fmt package is for simply displaying text "io/ioutil" :  this is used to Read the directory publicFolder "net/http" : this will be used for routing "io" : This will mostly be used for writing the file to response writer Lets first see the main function We will be listening to the port 8080 , with Default ServeMux which is indicated by a nil in...