30 lines
658 B
Go
30 lines
658 B
Go
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)
|
|
}
|
|
}
|