File tree 9 files changed +10
-11
lines changed
9 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ async fn echo_form(mut cx: Context<()>) -> EndpointResult {
39
39
Ok ( forms:: form ( msg) )
40
40
}
41
41
42
- fn main ( ) {
42
+ pub fn main ( ) {
43
43
let mut app = App :: new ( ) ;
44
44
45
45
app. at ( "/echo/string" ) . post ( echo_string) ;
Original file line number Diff line number Diff line change 1
1
use tide:: Context ;
2
2
3
- pub async fn echo_path ( cx : Context < ( ) > ) -> String {
3
+ async fn echo_path ( cx : Context < ( ) > ) -> String {
4
4
let path: String = cx. param ( "path" ) . unwrap ( ) ;
5
5
format ! ( "Your path is: {}" , path)
6
6
}
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ use cookie::Cookie;
2
2
use tide:: { cookies:: CookiesExt , middleware:: CookiesMiddleware , Context } ;
3
3
4
4
/// Tide will use the the `Cookies`'s `Extract` implementation to build this parameter.
5
- ///
6
5
async fn retrieve_cookie ( mut cx : Context < ( ) > ) -> String {
7
6
format ! ( "hello cookies: {:?}" , cx. get_cookie( "hello" ) . unwrap( ) )
8
7
}
@@ -17,7 +16,7 @@ async fn remove_cookie(mut cx: Context<()>) {
17
16
cx. remove_cookie ( Cookie :: named ( "hello" ) ) . unwrap ( ) ;
18
17
}
19
18
20
- fn main ( ) {
19
+ pub fn main ( ) {
21
20
let mut app = tide:: App :: new ( ) ;
22
21
app. middleware ( CookiesMiddleware :: new ( ) ) ;
23
22
Original file line number Diff line number Diff line change 1
1
use tide:: middleware:: DefaultHeaders ;
2
2
3
- fn main ( ) {
3
+ pub fn main ( ) {
4
4
let mut app = tide:: App :: new ( ) ;
5
5
6
6
app. middleware (
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ async fn handle_graphql(mut cx: Context<Data>) -> EndpointResult {
56
56
Ok ( resp)
57
57
}
58
58
59
- fn main ( ) {
59
+ pub fn main ( ) {
60
60
let mut app = App :: with_state ( Data :: default ( ) ) ;
61
61
app. at ( "/graphql" ) . post ( handle_graphql) ;
62
62
app. serve ( "127.0.0.1:8000" ) . unwrap ( ) ;
Original file line number Diff line number Diff line change 1
- fn main ( ) {
1
+ pub fn main ( ) {
2
2
let mut app = tide:: App :: new ( ) ;
3
3
app. at ( "/" ) . get ( async move |_| "Hello, world!" ) ;
4
4
app. serve ( "127.0.0.1:8000" ) . unwrap ( ) ;
Original file line number Diff line number Diff line change 1
1
#![ feature( async_await) ]
2
- #![ allow( unused) ]
3
2
#![ warn( clippy:: all) ]
3
+ #![ allow( dead_code) ]
4
4
5
5
mod body_types;
6
6
mod catch_all;
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ async fn get_message(cx: Context<Database>) -> EndpointResult {
64
64
}
65
65
}
66
66
67
- fn main ( ) {
67
+ pub fn main ( ) {
68
68
let mut app = App :: with_state ( Database :: default ( ) ) ;
69
69
app. at ( "/message" ) . post ( new_message) ;
70
70
app. at ( "/message/:id" ) . get ( get_message) . post ( set_message) ;
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ impl StaticFile {
42
42
// Check if the path exists and handle if it's a directory containing `index.html`
43
43
if meta. is_some ( ) && meta. as_ref ( ) . map ( |m| !m. is_file ( ) ) . unwrap_or ( false ) {
44
44
// Redirect if path is a dir and URL doesn't end with "/"
45
- if !actual_path. ends_with ( "/" ) {
45
+ if !actual_path. ends_with ( '/' ) {
46
46
return Ok ( response
47
47
. status ( StatusCode :: MOVED_PERMANENTLY )
48
48
. header ( header:: LOCATION , String :: from ( actual_path) + "/" )
@@ -119,7 +119,7 @@ async fn handle_path(ctx: Context<StaticFile>) -> EndpointResult {
119
119
} )
120
120
}
121
121
122
- fn main ( ) {
122
+ pub fn main ( ) {
123
123
let mut app = App :: with_state ( StaticFile :: new ( "./" ) ) ;
124
124
app. at ( "/*" ) . get ( handle_path) ;
125
125
app. serve ( "127.0.0.1:8000" ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments