use std::sync::{
    atomic::{AtomicUsize, Ordering},
    Arc,
};
use warp::Filter;

#[tokio::main]
async fn main() {
    let serial_id = Arc::new(AtomicUsize::new(0));
    let server = warp::get().and(warp::path("next_id")).map(move || {
        let next_id = serial_id.fetch_add(1, Ordering::SeqCst);
        next_id.to_string()
    });
    warp::serve(server).run(([0, 0, 0, 0], 8000)).await
}
