4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();
113. 🤣🤣🤣🤣
12
13## API
14
15This val uses the [icanhazdadjoke API](https://icanhazdadjoke.com/api). You can find [more docs here](https://github.com/15Dkatz/official_joke_api), such as how to [filter by type](https://github.com/15Dkatz/official_joke_api?tab=readme-ov-file#grab-jokes-by-type).
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
7 text: punchline,
1import { API_URL } from "https://esm.town/v/std/API_URL";
2import { LibsqlError, type ResultSet, type Row, type TransactionMode } from "npm:@libsql/client";
3import { z } from "npm:zod";
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
54 headers: {
78
79/* Val Town's Turso Proxy returns rows as an array of values
80 * Yet the LibSQL API has a Row type which behave as an array or object,
81 * ie you can access it via numerical index or string
82 */
138 <meta name="viewport" content="width=device-width, initial-scale=1.0">
139 <title>Radical Text Analyser</title>
140 <link href="https://fonts.googleapis.com/css2?family=VT323&display=swap" rel="stylesheet">
141 <script src="https://cdnjs.cloudflare.com/ajax/libs/jqcloud/1.0.4/jqcloud-1.0.4.min.js"></script>
142 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqcloud/1.0.4/jqcloud.min.css">
4
5This val gets Twitter data via [SocialData](https://socialdata.tools) via
6@stevekrouse/socialDataProxy. Val Town Pro users can call this API
7100 times per day, so be sure not to set this cron to run more than once every 15 min.
8If you want to use it more, get your own [SocialData](https://socialdata.tools)
9API token and pay for it directly.
10
11## 1. Query
13Change the `query` variable for what you want to get notified for.
14
15You can use [Twitter's search operators](https://developer.twitter.com/en/docs/twitter-api/v1/rules-and-filtering/search-operators) to customize your query, for some collection of keywords, filtering out others, and much more!
16
17## 2. Notification
25
26### Consciousness and the Cosmos
27Contemplate the nature of **consciousness** and its role in shaping reality. Explore theories of the universe as a **holographic projection** of consciousness itself and how this could provide a framework for magical manifestation and psychic abilities.
28
29
74 {
75 text: "Express.js",
76 description: "Domina Express.js para crear aplicaciones web y APIs de manera rápida y eficiente.",
77 completed: false
78 },
119 {
120 id: 5,
121 title: "APIs y Autenticación",
122 description: "Desarrolla APIs RESTful seguras, implementa autenticación y autorización usando las mejores prácticas de Node.js.",
123 completed: false,
124 subtopics: [
125 {
126 text: "Diseño de APIs RESTful",
127 description: "Aprende principios de diseño de APIs RESTful, buenas prácticas y patrones de arquitectura.",
128 completed: false
129 },
139 },
140 {
141 text: "Seguridad en APIs",
142 description: "Aprende técnicas de seguridad como validación de entrada, prevención de inyección, y manejo de CORS.",
143 completed: false
37 e.preventDefault();
38 try {
39 const response = await fetch("/api/vehicle", {
40 method: "POST",
41 headers: {
124
125 const fetchAllVehicles = async () => {
126 const response = await fetch("/api/all-vehicles");
127 const data = await response.json();
128 setVehicles(data);
235
236 const fetchVehicles = async (company) => {
237 const response = await fetch(`/api/vehicles?company=${company}`);
238 const data = await response.json();
239 setVehicles(data);
241
242 const fetchAllVehicles = async () => {
243 const response = await fetch("/api/all-vehicles");
244 const data = await response.json();
245 return data;
480 const path = url.pathname;
481
482 if (request.method === "POST" && path === "/api/vehicle") {
483 const body = await request.json();
484 await sqlite.execute(
506 }
507
508 if (path === "/api/vehicles") {
509 const company = url.searchParams.get("company");
510 const vehicles = await sqlite.execute(`SELECT * FROM ${KEY}_vehicles_${SCHEMA_VERSION} WHERE company = ?`, [
516 }
517
518 if (path === "/api/all-vehicles") {
519 const vehicles = await sqlite.execute(`SELECT * FROM ${KEY}_vehicles_${SCHEMA_VERSION}`);
520 return new Response(JSON.stringify(vehicles.rows), {
523 }
524
525 if (path.startsWith("/api/vehicle/")) {
526 const plateNumber = path.split("/").pop();
527 const vehicle = await sqlite.execute(`SELECT * FROM ${KEY}_vehicles_${SCHEMA_VERSION} WHERE plateNumber = ?`, [
47 ],
48 projects: [
49 { text: "API REST básica", completed: false },
50 { text: "Servidor de archivos", completed: false },
51 { text: "Sistema de autenticación simple", completed: false },