aboutsummaryrefslogtreecommitdiff
path: root/backend/src/bin/server.rs
diff options
context:
space:
mode:
Diffstat (limited to 'backend/src/bin/server.rs')
-rw-r--r--backend/src/bin/server.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/backend/src/bin/server.rs b/backend/src/bin/server.rs
index 7c67e4f..310914e 100644
--- a/backend/src/bin/server.rs
+++ b/backend/src/bin/server.rs
@@ -5,7 +5,7 @@ use actix_web::{web, App, HttpServer};
5use diesel::r2d2::{ConnectionManager, Pool}; 5use diesel::r2d2::{ConnectionManager, Pool};
6use diesel::MysqlConnection; 6use diesel::MysqlConnection;
7use furby::handlers::smoke::manual_hello; 7use furby::handlers::smoke::manual_hello;
8use furby::handlers::{cart_items, product, rating, users}; 8use furby::handlers::{cart_items, product, rating, transaction, users};
9use rand::Rng; 9use rand::Rng;
10 10
11#[actix_web::main] 11#[actix_web::main]
@@ -48,6 +48,7 @@ async fn main() -> std::io::Result<()> {
48 web::scope("/user") 48 web::scope("/user")
49 .route("/existing", web::post().to(users::name_exists)) 49 .route("/existing", web::post().to(users::name_exists))
50 .route("/login", web::post().to(users::login)) 50 .route("/login", web::post().to(users::login))
51 .route("/logout", web::post().to(users::logout))
51 .route("/{uname}", web::get().to(users::user_details)) 52 .route("/{uname}", web::get().to(users::user_details))
52 .route("/new", web::post().to(users::new_user)) 53 .route("/new", web::post().to(users::new_user))
53 .route( 54 .route(
@@ -75,6 +76,10 @@ async fn main() -> std::io::Result<()> {
75 "/items", 76 "/items",
76 web::get().to(cart_items::get_user_cart_items), 77 web::get().to(cart_items::get_user_cart_items),
77 ) 78 )
79 .route(
80 "/total",
81 web::get().to(cart_items::get_user_cart_total),
82 )
78 .route("/add", web::post().to(cart_items::add_to_cart)) 83 .route("/add", web::post().to(cart_items::add_to_cart))
79 .route( 84 .route(
80 "/remove", 85 "/remove",
@@ -86,6 +91,17 @@ async fn main() -> std::io::Result<()> {
86 .route("/add", web::post().to(rating::add_rating)) 91 .route("/add", web::post().to(rating::add_rating))
87 .route("/remove", web::post().to(rating::remove_rating)), 92 .route("/remove", web::post().to(rating::remove_rating)),
88 ) 93 )
94 .service(
95 web::scope("/transaction")
96 .route(
97 "/checkout",
98 web::post().to(transaction::checkout_cart),
99 )
100 .route(
101 "/list",
102 web::get().to(transaction::list_transactions),
103 ),
104 )
89 .route("/hey", web::get().to(manual_hello)) 105 .route("/hey", web::get().to(manual_hello))
90 }) 106 })
91 .bind("127.0.0.1:7878")? 107 .bind("127.0.0.1:7878")?