Add Blog Posts CRUD with SQLite

- Add modernc.org/sqlite (pure Go, no CGO)
- Create models package with Post struct
- Implement SQLite connection and schema auto-creation
- Add CRUD methods to database package
- Create post handlers with JSON API
- Register API routes: GET/POST/PUT/DELETE /api/v1/posts
- Set default DBURL to file:./data.db with WAL mode
This commit is contained in:
2025-12-27 12:43:30 +07:00
parent fb347b96df
commit f7ab09c2c3
8 changed files with 474 additions and 10 deletions

View File

@@ -59,7 +59,7 @@ func New(lc fx.Lifecycle, params ConfigParams) (*Config, error) {
viper.SetDefault("DEV_ADMIN_USERNAME", "")
viper.SetDefault("DEV_ADMIN_PASSWORD", "")
viper.SetDefault("PORT", "8080")
viper.SetDefault("DBURL", "")
viper.SetDefault("DBURL", "file:./data.db?_journal_mode=WAL")
viper.SetDefault("SENTRY_DSN", "")
viper.SetDefault("METRICS_USERNAME", "")
viper.SetDefault("METRICS_PASSWORD", "")