I would do something like this using flask in Python:
@app.route('/login/', methods=['POST'])
def login():
token = request.headers["token"]
I cannot figure out how to access the token header and store it as a String variable.
#![feature(proc_macro_hygiene, decl_macro)]
use rocket::{
config::{Config, Environment},
*,
};
fn main() {
let config = Config::build(Environment::Production)
.address("0.0.0.0")
.port(PORT)
.finalize()
.unwrap();
rocket::ignite().mount("/", routes![login]).launch();
}
#[post("/login")]
fn login() {
// Retrieve headers from request.
}