doordesk-js/reqtest/src/main.rs

25 lines
507 B
Rust
Raw Normal View History

2023-07-10 20:59:52 -04:00
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
struct Article {
content_type: String,
title: String,
date: String,
content: String,
}
async fn get_articles() {
let resp = reqwest::get("https://dennis.doordesk.net/home")
.await?
.json::<Vec<Article>>();
return resp.await;
}
#[tokio::main]
async fn main() {
for article in get_articles() {
println!("{} {} {}", article.date, article.content_type, article.title);
}
}