Static content serving from non-root routes

This commit is contained in:
Jai A
2020-06-02 20:59:20 -07:00
parent e03e58323b
commit a47634bf49
10 changed files with 102 additions and 76 deletions

View File

@@ -1,8 +1,8 @@
mod index;
mod mod_editor;
mod mod_page;
mod search;
pub use self::mod_editor::mod_editor_get;
pub use self::mod_page::mod_page_get;
pub use self::search::index_mods;
pub use self::search::search_get;

View File

@@ -1,8 +1,8 @@
use actix_web::{get, web, HttpResponse};
use handlebars::*;
#[get("modeditor")]
pub async fn mod_editor_get(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
#[get("mod/testmod")]
pub async fn mod_page_get(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
let data = json!({
"name": "Handlebars"
});

View File

@@ -174,8 +174,8 @@ TODO This method needs a lot of refactoring. Here's a list of changes that need
pub async fn index_mods(client: mongodb::Client) -> Result<(), Box<dyn Error>>{
let mut docs_to_add: Vec<SearchMod> = vec![];
docs_to_add.append(&mut index_database(client).await?);
docs_to_add.append(&mut index_curseforge().await);
/*docs_to_add.append(&mut index_database(client).await?);
docs_to_add.append(&mut index_curseforge().await?);*/
//Write Indexes
//Relevance Index
@@ -252,7 +252,7 @@ async fn index_database(client: mongodb::Client) -> Result<Vec<SearchMod>, Box<
versions: mod_game_versions,
downloads: result.downloads,
page_url: "".to_string(),
icon_url: "".to_string(),
icon_url: result.icon_path,
author_url: "".to_string(),
date_created: "".to_string(),
created: 0,