Readme

This val allows you to send me an email at a certain datetime. Fun!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { emailServiceCreate } from "https://esm.town/v/neverstew/emailServiceCreate";
export let scheduleEmail = async (req: express.Request, res: express.Response) => {
const z = await import("npm:zod");
const params = z.object({
sendAt: z.string().datetime(),
content: z.string(),
});
const sendAt = req.query.sendAt;
const content = req.query.content;
const parsedParams = params.safeParse({ sendAt, content });
if (parsedParams.success) {
await emailServiceCreate(parsedParams.data);
res.send(`Scheduled for ${sendAt}`);
}
else {
res.send(JSON.stringify(parsedParams.error.format()));
}
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023