From 2a112855e54ea3a365fa032e8726196a7eec9a06 Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 16 Dec 2020 22:12:50 +0530 Subject: begin working on rating endpoints --- src/bin/server.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/bin') 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}; use diesel::r2d2::{ConnectionManager, Pool}; use diesel::MysqlConnection; use furby::handlers::smoke::manual_hello; -use furby::handlers::{cart_items, product, users}; +use furby::handlers::{cart_items, product, rating, users}; use rand::Rng; #[actix_web::main] @@ -45,6 +45,10 @@ async fn main() -> std::io::Result<()> { .route("/catalog", web::get().to(product::get_all_products)) .route("/new", web::post().to(product::new_product)) .route("/{id}", web::get().to(product::product_details)) + .route( + "/reviews/{id}", + web::get().to(product::get_product_reviews), + ) .route( "/update_product/{id}", web::post().to(product::update_product), @@ -62,6 +66,11 @@ async fn main() -> std::io::Result<()> { web::post().to(cart_items::remove_from_cart), ), ) + .service( + web::scope("/rating") + .route("/add", web::post().to(rating::add_rating)) + .route("/remove", web::post().to(rating::remove_rating)), + ) .route("/hey", web::get().to(manual_hello)) }) .bind("127.0.0.1:7878")? -- cgit v1.2.3