1#[macro_export]
2macro_rules! get {
3 ($path:literal, $handler:expr) => {
5 $crate::cfg.route($path, ::actix_web::web::get().to($handler))
6 };
7 ($path:literal, $handler:expr, $($extra:tt)*) => {
9 $crate::cfg.route($path, ::actix_web::web::get().to($handler).$($extra)*)
10 };
11}
12
13#[macro_export]
14macro_rules! post {
15 ($path:literal, $handler:expr) => {
16 $crate::cfg.route($path, ::actix_web::web::post().to($handler))
17 };
18 ($path:literal, $handler:expr, $($extra:tt)*) => {
19 $crate::cfg.route($path, ::actix_web::web::post().to($handler).$($extra)*)
20 };
21}
22
23#[macro_export]
24macro_rules! put {
25 ($path:literal, $handler:expr) => {
26 $crate::cfg.route($path, ::actix_web::web::put().to($handler))
27 };
28 ($path:literal, $handler:expr, $($extra:tt)*) => {
29 $crate::cfg.route($path, ::actix_web::web::put().to($handler).$($extra)*)
30 };
31}
32
33#[macro_export]
34macro_rules! delete {
35 ($path:literal, $handler:expr) => {
36 $crate::cfg.route($path, ::actix_web::web::delete().to($handler))
37 };
38 ($path:literal, $handler:expr, $($extra:tt)*) => {
39 $crate::cfg.route($path, ::actix_web::web::delete().to($handler).$($extra)*)
40 };
41}
42
43#[macro_export]
44macro_rules! patch {
45 ($path:literal, $handler:expr) => {
46 $crate::cfg.route($path, ::actix_web::web::patch().to($handler))
47 };
48 ($path:literal, $handler:expr, $($extra:tt)*) => {
49 $crate::cfg.route($path, ::actix_web::web::patch().to($handler).$($extra)*)
50 };
51}
52
53#[macro_export]
54macro_rules! head {
55 ($path:literal, $handler:expr) => {
56 $crate::cfg.route($path, ::actix_web::web::head().to($handler))
57 };
58 ($path:literal, $handler:expr, $($extra:tt)*) => {
59 $crate::cfg.route($path, ::actix_web::web::head().to($handler).$($extra)*)
60 };
61}
62
63#[macro_export]
64macro_rules! options {
65 ($path:literal, $handler:expr) => {
66 $crate::cfg.route($path, ::actix_web::web::options().to($handler))
67 };
68 ($path:literal, $handler:expr, $($extra:tt)*) => {
69 $crate::cfg.route($path, ::actix_web::web::options().to($handler).$($extra)*)
70 };
71}
72
73#[macro_export]
74macro_rules! scope {
75 ($path:literal, { $($content:tt)* }) => {
76 $crate::cfg.service(
77 ::actix_web::web::scope($path)
78 .$($content)*
79 )
80 };
81 ($path:literal, $($extra:tt)*, { $($content:tt)* }) => {
82 $crate::cfg.service(
83 ::actix_web::web::scope($path)
84 .$($extra)*
85 .$($content)*
86 )
87 };
88}
89
90#[macro_export]
91macro_rules! resource {
92 ($path:literal, $($content:tt)*) => {
93 $crate::cfg.service(
94 ::actix_web::web::resource($path)
95 .$($content)*
96 )
97 };
98 ($path:literal, $($extra:tt)*, { $($content:tt)* }) => {
99 $crate::cfg.service(
100 ::actix_web::web::resource($path)
101 .$($extra)*
102 .$($content)*
103 )
104 };
105}