Zikado
Zikado
TTCTheo's Typesafe Cult
Created by Zikado on 3/1/2024 in #questions
Planetscale billing
Hi, on account of the Theo's video about Netlify billing I panicked a little. I tried to find a mention about what happens when Planetscale free tier exceeds but only with a little luck in FAQ saying "Databases that exceed the Hobby plan in usage or storage without current billing may experience degraded service." which does not really rule out billing, so my question is what happens when exceeding the free tier? Thanks for any insight.
9 replies
TTCTheo's Typesafe Cult
Created by Zikado on 11/25/2023 in #questions
Compiling user's code - the right way
Hi, so I have been trying to create some kind of a leetcode like app for JS code only in my SvelteKit app. I run into a problem that I have no clue how to actually do that right. I have already been able to create something using 'isolated-vm' but it does not look like the best way to do it.
import { json } from "@sveltejs/kit"
import ivm from "isolated-vm"

export const POST = async ({ request }) => {
const { code } = await request.json()
console.log(code)
if (!code) throw new Error('No code provided');

const isolate = new ivm.Isolate();
const context = await isolate.createContext();

try {
const result = await (await isolate.compileScript(code)).run(context);
console.log(result)
if (result === undefined) return json('undefined');
return json(result.toString());
} catch (error) {
throw new Error(error);
} finally {
await isolate.dispose();
}
}
import { json } from "@sveltejs/kit"
import ivm from "isolated-vm"

export const POST = async ({ request }) => {
const { code } = await request.json()
console.log(code)
if (!code) throw new Error('No code provided');

const isolate = new ivm.Isolate();
const context = await isolate.createContext();

try {
const result = await (await isolate.compileScript(code)).run(context);
console.log(result)
if (result === undefined) return json('undefined');
return json(result.toString());
} catch (error) {
throw new Error(error);
} finally {
await isolate.dispose();
}
}
So that's it I guess, hope someone smart will come by this, thanks for any help :).
4 replies