There will be times when you would need to serve contents of a single non-HTML file on a web server. The following is a simple and quick way.
If you want to serve the file payload.txt
using Golang, save the following code to a file main.go
.
|
|
Execute the code using go run main.go
.
Remember: If you want to serve a different file or on a different port, change the code.