如何访问 sveltekit 端点中的会话?我已经尝试过这个但没有运气:
import { get } from 'svelte/store';
import { getStores} from "$app/stores";
function getUser() { // <- call this at component initialization
const { session } = getStores();
return {
current: () => get(session).user
}
}
Run Code Online (Sandbox Code Playgroud) 我在 sveltekits 中不明白一件事。我将端点保存在 /routes/api/ 中。它们对于构建、生产中的用户来说是不可见的吗?在开发中,我可以通过浏览器或邮递员访问它们。安全吗?