-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
34 lines (29 loc) · 934 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
package main
import (
"github.com/charmbracelet/log"
"github.com/kunalsin9h/notex/config"
"github.com/kunalsin9h/notex/data"
_ "github.com/kunalsin9h/notex/docs"
)
// @title Notex API
// @version 1.0
// @description Yet another note taking app (for speer.io assignment)
// @host localhost:7000
// @basePath /api
// @schemes http
// @securityDefinitions.basic BasicAuth
// @securityDefinitions.apikey ApiKeyAuth
// @in header
// @name X-API-Key
func main() {
// MongoDB connection string and application port can also be
// taken from some sort of config file or environment variable
// to make application simple they are hard coded here
mongoDBConnectionString := "mongodb://localhost:27017" // !
app := &config.Config{
Repo: data.NewMongoDB(mongoDBConnectionString, "notex"),
Port: 7000, // !
}
log.Infof("Starting server on at: http://127.0.0.1:%d\n", app.Port)
app.Run()
}