Browse Source

init

master
SeraphJACK 2 years ago
commit
e9cdad0263
Signed by: SeraphJACK <seraphjack@outlook.com> GPG Key ID: 14162B46567AB06F
5 changed files with 41 additions and 0 deletions
  1. +2
    -0
      .gitignore
  2. +5
    -0
      go.mod
  3. +2
    -0
      go.sum
  4. +18
    -0
      http/server.go
  5. +14
    -0
      main.go

+ 2
- 0
.gitignore View File

@@ -0,0 +1,2 @@
.idea/


+ 5
- 0
go.mod View File

@@ -0,0 +1,5 @@
module votes

go 1.14

require github.com/gorilla/mux v1.7.4

+ 2
- 0
go.sum View File

@@ -0,0 +1,2 @@
github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc=
github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=

+ 18
- 0
http/server.go View File

@@ -0,0 +1,18 @@
package http

import (
"github.com/gorilla/mux"
"log"
"net/http"
)

func Start(listen string) error {
router := mux.NewRouter()
// TODO add handlers
err := http.ListenAndServe(listen, router)
if err != nil {
log.Println("HTTP server listening on ", listen)
}
return err

}

+ 14
- 0
main.go View File

@@ -0,0 +1,14 @@
package main

import (
"flag"
"votes/http"
)

func main() {
var l string
flag.StringVar(&l, "l", "127.0.0.1:8080", "Listen")
flag.Parse()

_ = http.Start(l)
}

Loading…
Cancel
Save