Skip to content

Instantly share code, notes, and snippets.

@acoyfellow

acoyfellow/test.js

Last active Mar 18, 2021
Embed
What would you like to do?
SvelteKit server route example
import { firebase } from "$services/firebaseAdmin";
export const get = async (req, context) => {
const globalRef = firebase.firestore().collection('global');
let data = {
now: Date.now()
};
const snapshot = await globalRef.get();
snapshot.forEach(doc => {
data[doc.id] = doc.data();
});
return {
body: data,
status: 200
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment