Skip to content

Instantly share code, notes, and snippets.

View leovafme's full-sized avatar
🏠
Working from home

Leonardo Valencia leovafme

🏠
Working from home
View GitHub Profile
@leovafme
leovafme / schema.js
Created February 1, 2018 19:30 — forked from simenbrekken/schema.js
Firebase backed GraphQL schema
import firebase from 'firebase'
import { filter, map } from 'lodash'
import { makeExecutableSchema } from 'graphql-tools'
firebase.initializeApp({
databaseURL: 'https://grafire-b1b6e.firebaseio.com',
})
const mapSnapshotToEntity = snapshot => ({ id: snapshot.key, ...snapshot.val() })
const mapSnapshotToEntities = snapshot => map(snapshot.val(), (value, id) => ({ id, ...value }))
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
#loadingElement
{
animation: preloadAnimation 1s cubic-bezier(0, 0, 0.3, 1) 0.5s;