Added CallbackApp to better access backend.Backend from with in an App

Fixed issues with CORS not being able to do an OPTIONS request
Fixed folders not being processed properly.
Fixed some other issues.
This commit is contained in:
Caleb Gardner
2024-08-07 02:24:54 -05:00
parent a9ca12395e
commit 2afbd64dc2
6 changed files with 39 additions and 22 deletions
+5 -2
View File
@@ -16,9 +16,8 @@ type BlogApp struct {
conv *bbConvert.HTMLConverter
}
func NewBlogApp(b *backend.Backend, db *mongo.Database) *BlogApp {
func NewBlogApp(db *mongo.Database) *BlogApp {
out := &BlogApp{
back: b,
blogCol: db.Collection("blog"),
authCol: db.Collection("author"),
portfolioCol: db.Collection("portfolio"),
@@ -40,6 +39,10 @@ func (b *BlogApp) CrashTable() backend.CrashTable {
return nil
}
func (b *BlogApp) AddBackend(back *backend.Backend) {
b.back = back
}
func (b *BlogApp) Extension(mux *http.ServeMux) {
mux.HandleFunc("GET /blog", b.reqLatestBlogs)
mux.HandleFunc("GET /blog/list", b.reqBlogList)