forked from melvinodsa/joinslack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
36 lines (29 loc) · 926 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//Join Slack application will send automatic invites to anyone who sign up to the workspace
package main
import (
"log"
"net/http"
"strconv"
"github.com/gogurgaon/joinslack/api"
"github.com/gogurgaon/joinslack/config"
)
func main() {
/*
* We will first load the configs
* Signup page as index page will be registered with the handler
* User sign up action will be registered with the handler
* Will serve the static contents
* Start the server
*/
//Loading the configs
config.LoadConfig()
//Signup page
http.HandleFunc("/", api.SignupPage)
//Signup request from user
http.HandleFunc("/signup", api.Signup)
//static file contents
http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir(*config.STATIC))))
//starting the server
log.Println("Serving at localhost:", strconv.Itoa(*config.PORT), "...")
log.Fatal(http.ListenAndServe(":"+strconv.Itoa(*config.PORT), nil))
}