Skip to content

Instantly share code, notes, and snippets.

@shohi
Last active March 16, 2020 01:20
Show Gist options
  • Save shohi/aeffabca6f9f2dd533592427a78e295d to your computer and use it in GitHub Desktop.
Save shohi/aeffabca6f9f2dd533592427a78e295d to your computer and use it in GitHub Desktop.
simple servers

Simple Server

Python

# port 8000
python2 -m SimpleHTTPServer 8000

# port 8080
python3 -m http.server 8080

Golang

require gorun

#!/usr/bin/env gorun

// simple.go
package main

import (
	"log"
	"net/http"
)

func main() {
	fs := http.FileServer(http.Dir("."))
	http.Handle("/", fs)

	log.Println("Listening on :3000...")
	err := http.ListenAndServe(":3000", nil)
	if err != nil {
		log.Fatal(err)
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment