app.post('/signup', async (c) => {
const { email, password } = await c.req.json();
const auth = initializeAuth(c.env.TURSO_DB_URL, c.env.TURSO_AUTH_TOKEN);
try {
const userDetails = await auth
.createUser({
key: {
providerId: 'email',
providerUserId: email,
password,
},
attributes: {},
})
.catch(console.log);
console.log(userDetails);
return c.json({ status: 'ok' });
} catch (e) {
return c.json({ status: 'error', message: e });
}
});
app.post('/signup', async (c) => {
const { email, password } = await c.req.json();
const auth = initializeAuth(c.env.TURSO_DB_URL, c.env.TURSO_AUTH_TOKEN);
try {
const userDetails = await auth
.createUser({
key: {
providerId: 'email',
providerUserId: email,
password,
},
attributes: {},
})
.catch(console.log);
console.log(userDetails);
return c.json({ status: 'ok' });
} catch (e) {
return c.json({ status: 'error', message: e });
}
});