diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-07-13 00:52:57 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-07-13 01:09:54 +0900 |
| commit | 732c71f7c2e5f0a37c03c2efedcfa8e5360e3fda (patch) | |
| tree | 619d28354e48f55fd5efe9a0298c7d61b6d7393f /backend/main.go | |
| parent | 756b66b31fd02215fc2d8a30ae263a3bf08a90a6 (diff) | |
| download | feedaka-732c71f7c2e5f0a37c03c2efedcfa8e5360e3fda.tar.gz feedaka-732c71f7c2e5f0a37c03c2efedcfa8e5360e3fda.tar.zst feedaka-732c71f7c2e5f0a37c03c2efedcfa8e5360e3fda.zip | |
feat(container): fix Docker build
Diffstat (limited to 'backend/main.go')
| -rw-r--r-- | backend/main.go | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/backend/main.go b/backend/main.go index 150e0af..0efe66a 100644 --- a/backend/main.go +++ b/backend/main.go @@ -34,28 +34,14 @@ import ( var ( database *sql.DB queries *db.Queries - //go:embed static/* - staticFS embed.FS + //go:embed public/* + publicFS embed.FS + //go:embed db/schema.sql + dbSchema string ) func initDB(db *sql.DB) error { - _, err := db.Exec(` -CREATE TABLE IF NOT EXISTS feeds ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - url TEXT NOT NULL, - title TEXT NOT NULL, - fetched_at TEXT NOT NULL -); - -CREATE TABLE IF NOT EXISTS articles ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - feed_id INTEGER NOT NULL, - guid TEXT NOT NULL, - title TEXT NOT NULL, - url TEXT NOT NULL, - is_read INTEGER NOT NULL -); -`) + _, err := db.Exec(dbSchema) return err } @@ -186,7 +172,11 @@ func main() { e.Use(middleware.Recover()) e.Use(middleware.CORS()) - e.GET("/static/*", echo.WrapHandler(http.FileServer(http.FS(staticFS)))) + e.Use(middleware.StaticWithConfig(middleware.StaticConfig{ + HTML5: true, + Root: "public", + Filesystem: http.FS(publicFS), + })) // Setup GraphQL server srv := handler.New(graphql.NewExecutableSchema(graphql.Config{Resolvers: &resolver.Resolver{DB: database, Queries: queries}})) |
