Public
Back
Version 41
4/13/2024
/** @jsx jsx */
import { Hono } from "https://deno.land/x/hono@v3.1.3/mod.ts";
import { jsx } from "https://deno.land/x/hono@v3.1.3/middleware.ts";
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
const app = new Hono();
app.post("/eval", async (c) => {
const payload = await c.req.json();
const response = await fetchJSON('https://api.val.town/v1/eval', {
method: 'POST',
body: JSON.stringify(payload),
headers: {
'Authorization': `Bearer ${Deno.env.get('valtown')}`,
'Content-Type': 'application/json'
},
});
return c.json(response);
});
// Server-side rendering
app.get("/", async (c) => {
const html = (
<html>
<head>
<title>Val Town Eval Sandbox</title>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<style>{`
.loader {
border: 4px solid #f3f3f3;
border-top: 4px solid #3498db;
border-radius: 50%;
width: 30px;
height: 30px;
animation: spin 1s linear infinite;
yawnxyz-stringcoderunner.web.val.run
Updated: May 1, 2024