-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
39 lines (29 loc) · 796 Bytes
/
main.go
File metadata and controls
39 lines (29 loc) · 796 Bytes
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
37
38
39
package main
import(
"github.com/codegangsta/martini"
"os"
"flag"
)
var workspace string
func main(){
//Flags
port := flag.String("port","3000","Port to host on")
database := flag.String("database","database.db","Database file to use, creates one if it does not exist")
workspc := flag.String("workspace","workspace/","Location of the workspace to use")
flag.Parse()
workspace = *workspc
//Setup martini
m := martini.New()
m.Use(martini.Recovery())
m.Use(martini.Logger())
m.Map(martini.ReturnHandler(JSONReturnHandler))
os.Setenv("PORT", *port)
r := martini.NewRouter()
//Setup routes
Route(r)
//Setup the database and connection
SetupDB(*database)
//Start server
m.Action(r.Handle)
m.Run()
}