Public
Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import process from "node:process";
const { Redis } = await import("npm:@upstash/redis");
const redis = new Redis({
url: process.env.upstashURL,
token: process.env.upstashToken,
});
export let upstash = async (key: string, value?: any) => {
if (!value) {
return redis.get(key);
}
else {
await redis.set(key, value);
return value;
}
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
July 29, 2024
Can we move this code outside, so it is run only once?
Great idea!