128model: string;
129max_tokens: number;
130anthropic_api_key: string;
131mcp_servers?: Array<{
132type: string;
Det_Skide_Vaermain.tsx1 match
45const response = await fetch(
6`https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}¤t_weather=true`,
7);
8
ssscQuizadmin.http.ts9 matches
104});
105
106// API endpoint for JSON data
107app.get("/api/data", async c => {
108try {
109const submissionsResult = await sqlite.execute(`
133
134// Export individual submission data
135app.get("/api/export", async c => {
136try {
137const submissionsResult = await sqlite.execute(`
159
160// Delete individual submission
161app.delete("/api/submissions/:id", async c => {
162try {
163const id = c.req.param('id');
195
196// Refresh data endpoint (for real-time updates)
197app.get("/api/refresh", async c => {
198try {
199// Force refresh by redirecting back to main page
205
206// Debug endpoint to check database contents
207app.get("/api/debug", async c => {
208try {
209// Get all tables
527<p>Total Submissions: <strong>${total}</strong></p>
528<p style="font-size: 0.9rem; opacity: 0.8;">
529<a href="/api/debug" style="color: rgba(255,255,255,0.8); text-decoration: none;">🔍 Debug Database</a>
530</p>
531</div>
546<div class="table-actions">
547<button onclick="refreshData()" class="refresh-btn">🔄 Refresh</button>
548<a href="/api/export" class="export-btn">📥 Export CSV</a>
549</div>
550</div>
629
630try {
631const response = await fetch(\`/api/submissions/\${id}\`, {
632method: 'DELETE',
633headers: {
93- SQLite database with optimized schema and indexing
94- Enhanced email system with HTML/text templates
95- API endpoints for quiz submission and analytics
96- Static file serving for all frontend assets
97- Mobile-responsive design
106
107### Backend (Hono)
108- RESTful API with proper error handling
109- SQLite database with structured schema and indexes
110- Email automation with professional HTML templates
238
239### Environment Variables
240- `VAL_TOWN_API_KEY`: Automatically provided by Val Town
241- Optional overrides:
242- `ADMIN_EMAIL`: Admin notification email
269- **Advanced Analytics**: User behavior tracking
270- **Social Features**: Community building around archetypes
271- **API Integration**: Connect with event platforms
272
273### Technical Improvements
ssscQuizindex.http.ts7 matches
60});
61
62// API Routes
63app.post("/api/submit-quiz", async c => {
64try {
65const body = await c.req.json() as QuizSubmission;
159
160// Test email endpoint for debugging
161app.get("/api/test-email", async c => {
162try {
163console.log("Testing email functionality...");
182
183// Debug endpoint for troubleshooting
184app.get("/api/debug-config", async c => {
185try {
186return c.json({
198
199// Test insert endpoint for debugging
200app.get("/api/test-insert", async c => {
201try {
202console.log("Testing database insert...");
242
243// Enhanced debug endpoint to check table structure and data
244app.get("/api/debug-table", async c => {
245try {
246// Get table schema
286
287// Get analytics endpoint with proper error handling
288app.get("/api/analytics", async c => {
289try {
290const stats = await sqlite.execute(`
ssscQuizindex.html2 matches
11
12<!-- Fonts -->
13<link rel="preconnect" href="https://fonts.googleapis.com">
14<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
15<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Playfair+Display:wght@700;800&display=swap" rel="stylesheet">
16
17<!-- External Libraries -->
townie-testingexample-apis.ts10 matches
1export default async function(req: Request) {
2const url = new URL(req.url);
3const api = url.searchParams.get('api') || 'jsonplaceholder';
4
5try {
6let apiUrl: string;
7
8switch (api) {
9case 'jsonplaceholder':
10const randomUserId = Math.floor(Math.random() * 10) + 1; // Random int from 1 to 10
11apiUrl = `https://jsonplaceholder.typicode.com/users/${randomUserId}`;
12break;
13case 'httpbin':
14apiUrl = 'https://httpbin.org/json';
15break;
16case 'cat-facts':
17apiUrl = 'https://catfact.ninja/fact';
18break;
19case 'dog-api':
20apiUrl = 'https://dog.ceo/api/breeds/image/random';
21break;
22default:
23return new Response('Available APIs: jsonplaceholder, httpbin, cat-facts, dog-api\nUsage: ?api=jsonplaceholder', {
24headers: { 'Content-Type': 'text/plain' }
25});
26}
27
28const response = await fetch(apiUrl);
29
30if (!response.ok) {
70setIsSubmitting(true);
71try {
72const response = await fetch('/api/submit-quiz', {
73method: 'POST',
74headers: {
tuempresaallinone.tsx7 matches
34export default async function generateCartaPorteCFDI(req: Request): Promise<Response> {
5const AIRTABLE_API_KEY = Deno.env.get("AIRTABLE_API_KEY")!;
6const AIRTABLE_BASE_ID = Deno.env.get("AIRTABLE_BASE_ID")!;
7const FACTURAMA_AUTH = Deno.env.get("FACTURAMA_AUTH")!;
4344const airtableHeaders = {
45Authorization: `Bearer ${AIRTABLE_API_KEY}`,
46"Content-Type": "application/json",
47};
4849const fetchRecord = async (tableId: string, id: string) => {
50const res = await fetch(`https://api.airtable.com/v0/${AIRTABLE_BASE_ID}/${tableId}/${id}`, {
51headers: airtableHeaders,
52});
69form.append("upload_preset", CLOUDINARY_UPLOAD_PRESET);
7071const res = await fetch(`https://api.cloudinary.com/v1_1/${CLOUDINARY_CLOUD_NAME}/upload`, {
72method: "POST",
73body: form,
8384const updateAirtableFields = async (tableId: string, id: string, fields: Record<string, any>) => {
85const res = await fetch(`https://api.airtable.com/v0/${AIRTABLE_BASE_ID}/${tableId}/${id}`, {
86method: "PATCH",
87headers: airtableHeaders,
9596const fetchFromFacturama = async (id: string, type: "xml" | "pdf") => {
97const url = `https://apisandbox.facturama.mx/api/Cfdi/${type}/issued/${id}`;
98const res = await fetch(url, {
99headers: {
771console.log("Receiver Name enviado:", cfdi.Receiver.Name);
772773const facturamaRes = await fetch("https://apisandbox.facturama.mx/3/cfdis", {
774method: "POST",
775headers: {
203const { name, role } = acp.payload.content.crmData;
204const templates = {
205"Developer": "you'll find our API documentation and sandbox environment particularly useful",
206"Data Scientist": "our data integration pipelines and visualization tools will help you get insights faster",
207"Project Manager": "you can leverage our Gantt charts and reporting dashboards to keep your projects on track",
318name: "Automated Incident Response",
319description: "Diagnose and create a remediation plan for a system alert.",
320initialPayloadSchema: `{ "service": "api-gateway", "severity": "critical", "summary": "High CPU usage." }`,
321steps: [
322triageAgent,
563},
564565async apiCall(action, body) {
566this.elements.startBtn.disabled = true;
567this.elements.approveBtn.disabled = true;
573body: JSON.stringify(body),
574});
575if (!res.ok) throw new Error(\`API Error: \${res.statusText}\`);
576return await res.json();
577} catch (e) {
591this.state.currentPayload = payload;
592
593const data = await this.apiCall('runWorkflow', { workflowId: this.state.currentWorkflowId, payload });
594this.processApiResponse(data);
595},
596
606};
607
608const data = await this.apiCall('runWorkflow', {
609workflowId: this.state.currentWorkflowId,
610payload: this.state.currentPayload,
612stepIndex: this.state.nextStepIndex,
613});
614this.processApiResponse(data);
615},
616617processApiResponse(data) {
618if (!data) return;
619if(data.log) data.log.forEach(entry => this.logStatus(entry.agent, entry.status, entry.message));
621const result = data.finalResult;
622if(!result) {
623this.logStatus('system', 'error', 'API response was missing a final result.');
624return;
625}