Separating server and client for reasons ...
This commit is contained in:
29
isolated/server/main.go
Normal file
29
isolated/server/main.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"git.hrafn.xyz/aether/notes/internal/repository"
|
||||
"git.hrafn.xyz/aether/notes/internal/store/sqlite"
|
||||
"git.hrafn.xyz/aether/notes/server"
|
||||
)
|
||||
|
||||
func main() {
|
||||
databasefile := flag.String("db", filepath.Join(os.Getenv("HOME"), "notes.db"), "Path to the SQLite database file")
|
||||
dbPath := *databasefile
|
||||
sqliteStore, err := sqlite.NewSQLiteStore(context.Background(), dbPath)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer sqliteStore.Close()
|
||||
repo := repository.NewNoteRepository(sqliteStore)
|
||||
s := server.GetServer(repo, log.Default())
|
||||
err = s.Start(":8080")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user