added nested routes, added separate config struct, among other items
This commit is contained in:
@@ -1,2 +1,11 @@
|
||||
use sqlx::PgPool;
|
||||
|
||||
pub struct PostsDatasource;
|
||||
impl PostsDatasource {}
|
||||
impl PostsDatasource {
|
||||
pub async fn get_all(pool: PgPool) {
|
||||
sqlx::query("SELECT title, body, created_at FROM posts ORDER BY created_at DESC LIMIT 10")
|
||||
.fetch_all(&pool)
|
||||
.await;
|
||||
}
|
||||
pub async fn get_one(pool: PgPool) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user