You've already forked AstralRinth
forked from didirus/AstralRinth
Start mods page
This commit is contained in:
@@ -36,6 +36,7 @@ async fn main() -> std::io::Result<()> {
|
||||
.service(routes::index_get)
|
||||
.service(routes::search_post)
|
||||
.service(routes::search_get)
|
||||
.service(routes::mod_editor_get)
|
||||
})
|
||||
.bind("127.0.0.1:8000")?
|
||||
.run()
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
mod search;
|
||||
mod index;
|
||||
mod mod_editor;
|
||||
|
||||
pub use self::mod_editor::mod_editor_get;
|
||||
|
||||
pub use self::search::search_get;
|
||||
pub use self::search::search_post;
|
||||
|
||||
12
src/routes/mod_editor.rs
Normal file
12
src/routes/mod_editor.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
use actix_web::{web, HttpResponse, get, post};
|
||||
use handlebars::*;
|
||||
|
||||
#[get("modeditor")]
|
||||
pub async fn mod_editor_get(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
|
||||
let data = json!({
|
||||
"name": "Handlebars"
|
||||
});
|
||||
let body = hb.render("mod_editor", &data).unwrap();
|
||||
|
||||
HttpResponse::Ok().body(body)
|
||||
}
|
||||
@@ -101,7 +101,7 @@ pub fn index_mods(conn : PgConnection) {
|
||||
let results = mods.load::<Mod>(&conn).expect("Error loading mods!");
|
||||
let mut docs_to_add = vec![];
|
||||
|
||||
for result in results {getting confused
|
||||
for result in results {
|
||||
let mod_versions = versions.filter(mod_id.eq(result.id)).load::<Version>(&conn).expect("Error loading versions!");
|
||||
|
||||
let mut mod_game_versions = vec![];
|
||||
|
||||
Reference in New Issue
Block a user