Caramastifer
Caramastifer
DDeno
Created by Caramastifer on 12/21/2023 in #help
Get only the first records with deno kv but reversed ordered
I'm using Deno KV to store articles. Generating the ID for the articles:
export function generateUniqueChronologicallyOrderedId(): string {
return ulid();
}
export function generateUniqueChronologicallyOrderedId(): string {
return ulid();
}
this will order the articles in the DB chronologically in an ascendent way. If I want to get all the articles reversed ordered I'm doing:
export async function getAllArticles() {
const articles = [];

for await (const res of kv.list({ prefix: ["article"] })) {
articles.push(res.value);
}

return articles.reverse();
}
export async function getAllArticles() {
const articles = [];

for await (const res of kv.list({ prefix: ["article"] })) {
articles.push(res.value);
}

return articles.reverse();
}
But I want to get only the 4 most recent articles. How can I achieve that without waiting for the full database to load and then reverse it? Thank you very much for your help community!
3 replies
DDeno
Created by Caramastifer on 12/2/2023 in #help
Optimize for Prod simple static vanilla JS script - WebServer App with Oak + DEJS
Using DEJS to render views. Those views are served by Oak, according to the defined routes. What is the best approach to include a simple js script file, for client interactions (like switching on and off a button) in the view, but making sure that when going to Production it gets optimized? Minified, Compressed... maybe have some cache management...
5 replies
DDeno
Created by Caramastifer on 11/21/2023 in #help
Seamlessly include Tailwindcss
Is there a recommended way of achieving this at the moment? What is the cleneast way of including tailwindcss with postcss in a Deno project while having autocomplete for the development?
6 replies