sbmstd 0.6.4

Standard Middleware Library for Starberry
Documentation
# Please refer to the following link 

https://crates.io/crates/starberry 

# The standard starberry middleware library 

# Cors 

### Safty setting for APP & Cors support 

We are now able to add config to both APP and urls. For APP, we are able to set the config/static by using methods 

```rust 
pub static APP: SApp = Lazy::new(|| {
    App::new()
        .single_protocol(ProtocolBuilder::<HttpReqCtx>::new() 
            .append_middleware::<CookieSession>() // Append the cors middleware. The cors middleware's setting is a AppCorsSettings data  
        ) 
        .set_config( // Add a config data, which is a TypeID, Any HashMap 
            prelude::cors_settings::AppCorsSettings::new() // Store a data with the type of AppCorsSettings into config. The middleware will be able to figure this stored data out by using its TypeID 
        ) 
        .set_local( // Set a static data, which is a String, Any HashMap. When getting data you need to specify both String and Type 
            "key": "MySuperSecuredAdminKeyWhichIsSoLongThatCanProtectTheServerFromAnyAttack" 
        )
        .build() 
}); 
``` 

While for the Url, we are able to store params by using the `#[url]` macro 

```rust 
#[url(APP.reg_from(&[TEST_URL.clone(), LitUrl("get")]), config=[HttpSafety::new().with_allowed_method(HttpMethod::GET)])]  
async fn get_only() -> HttpResponse { 
    text_response("Get only")  
} 

#[url(APP.reg_from(&[TEST_URL.clone(), LitUrl("post")]), config=[HttpSafety::new().with_allowed_methods(vec![HttpMethod::POST])])]  
async fn post_only() -> HttpResponse { 
    text_response("Post only")  
}
``` 

# Session (Based On Cookie) 

(Learn how to use this by looking at the following repo as example) 

https://github.com/Field-of-Dreams-Studio/sfx 

# Session (Based on Cache, Deadlock is possible do not use this) 

### Function 

By using `Session` middleware, you will be able to store session in the memory 

### APP Statics & Configs 

**session_ttl: u64**, set the time for session to expire 

### Request Context 

**SessionRW**, access the Session content from this 

### Example 

```rust 
pub static APP: SApp = Lazy::new(|| {
    App::new().append_middleware::<Session>().build()
}); 

#[url(reg!(APP, LitUrl("session")))] 
```