diff options
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/server.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/bin/server.rs b/src/bin/server.rs index 601d514..5af3135 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs | |||
@@ -5,7 +5,7 @@ use actix_web::{web, App, HttpServer}; | |||
5 | use diesel::r2d2::{ConnectionManager, Pool}; | 5 | use diesel::r2d2::{ConnectionManager, Pool}; |
6 | use diesel::MysqlConnection; | 6 | use diesel::MysqlConnection; |
7 | use furby::handlers::smoke::manual_hello; | 7 | use furby::handlers::smoke::manual_hello; |
8 | use furby::handlers::{cart_items, product, users}; | 8 | use furby::handlers::{cart_items, product, rating, users}; |
9 | use rand::Rng; | 9 | use rand::Rng; |
10 | 10 | ||
11 | #[actix_web::main] | 11 | #[actix_web::main] |
@@ -46,6 +46,10 @@ async fn main() -> std::io::Result<()> { | |||
46 | .route("/new", web::post().to(product::new_product)) | 46 | .route("/new", web::post().to(product::new_product)) |
47 | .route("/{id}", web::get().to(product::product_details)) | 47 | .route("/{id}", web::get().to(product::product_details)) |
48 | .route( | 48 | .route( |
49 | "/reviews/{id}", | ||
50 | web::get().to(product::get_product_reviews), | ||
51 | ) | ||
52 | .route( | ||
49 | "/update_product/{id}", | 53 | "/update_product/{id}", |
50 | web::post().to(product::update_product), | 54 | web::post().to(product::update_product), |
51 | ), | 55 | ), |
@@ -62,6 +66,11 @@ async fn main() -> std::io::Result<()> { | |||
62 | web::post().to(cart_items::remove_from_cart), | 66 | web::post().to(cart_items::remove_from_cart), |
63 | ), | 67 | ), |
64 | ) | 68 | ) |
69 | .service( | ||
70 | web::scope("/rating") | ||
71 | .route("/add", web::post().to(rating::add_rating)) | ||
72 | .route("/remove", web::post().to(rating::remove_rating)), | ||
73 | ) | ||
65 | .route("/hey", web::get().to(manual_hello)) | 74 | .route("/hey", web::get().to(manual_hello)) |
66 | }) | 75 | }) |
67 | .bind("127.0.0.1:7878")? | 76 | .bind("127.0.0.1:7878")? |