Docker static html and model open fix
This commit is contained in:
+7
-1
@@ -53,12 +53,14 @@ CREATE TABLE IF NOT EXISTS files (
|
||||
id TEXT PRIMARY KEY,
|
||||
owner_id TEXT NOT NULL,
|
||||
document_id TEXT,
|
||||
folder_id TEXT,
|
||||
name TEXT NOT NULL,
|
||||
mime_type TEXT NOT NULL,
|
||||
data BLOB NOT NULL,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY(owner_id) REFERENCES users(id),
|
||||
FOREIGN KEY(document_id) REFERENCES documents(id)
|
||||
FOREIGN KEY(document_id) REFERENCES documents(id),
|
||||
FOREIGN KEY(folder_id) REFERENCES folders(id)
|
||||
);
|
||||
"#,
|
||||
)
|
||||
@@ -76,5 +78,9 @@ CREATE TABLE IF NOT EXISTS files (
|
||||
.execute(&pool)
|
||||
.await;
|
||||
|
||||
let _ = sqlx::query("ALTER TABLE files ADD COLUMN folder_id TEXT REFERENCES folders(id)")
|
||||
.execute(&pool)
|
||||
.await;
|
||||
|
||||
pool
|
||||
}
|
||||
|
||||
+3
-1
@@ -84,10 +84,12 @@ async fn main() {
|
||||
let yjs_routes = Router::new()
|
||||
.route("/{id}", get(yjs_handler));
|
||||
|
||||
let static_dir = std::env::var("STATIC_DIR").unwrap_or_else(|_| "../build".to_string());
|
||||
|
||||
let app = Router::new()
|
||||
.nest("/api", api_routes.layer(TraceLayer::new_for_http()))
|
||||
.nest("/yjs", yjs_routes.layer(TraceLayer::new_for_http()))
|
||||
.fallback_service(ServeDir::new("../build").fallback(ServeFile::new("../build/index.html")))
|
||||
.fallback_service(ServeDir::new(&static_dir).fallback(ServeFile::new(format!("{}/index.html", static_dir))))
|
||||
.with_state(state);
|
||||
|
||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000")
|
||||
|
||||
Reference in New Issue
Block a user