Crates.io | oneshotserver |
lib.rs | oneshotserver |
version | 1.0.0 |
source | src |
created_at | 2023-01-07 00:47:17.348486 |
updated_at | 2023-01-07 00:47:17.348486 |
description | A quick utility to create a simple web server which blocks the current thread until the first request is served. Usecases include handling incoming requests for usecases like OAuth token generation etc. |
homepage | https://github.com/Surya-06/rust-oneshotserver |
repository | https://github.com/Surya-06/rust-oneshotserver |
max_upload_size | |
id | 752702 |
size | 6,899 |
This is a crate for usecases where simple incoming http requests are to be handled for further data extraction. Usecases include OAuth token fetches where the token is usually sent as a response to a local webpage.
This crate only has one function start_listening_for_request
which takes a port number where the server will be hosted and a closure which runs after the incoming request is received. The request is handed over to the closure for further usage.
The function runs synchronously while blocking the thread where it is invoked on.