https://github.com/nixjs/apollo-server-cloud-functions
GraphQL on Cloud Functions for Firebase
https://github.com/nixjs/apollo-server-cloud-functions
Last synced: 5 months ago
JSON representation
GraphQL on Cloud Functions for Firebase
- Host: GitHub
- URL: https://github.com/nixjs/apollo-server-cloud-functions
- Owner: nixjs
- Created: 2019-12-01T13:59:11.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-07T02:12:34.000Z (about 6 years ago)
- Last Synced: 2025-04-21T10:03:36.668Z (8 months ago)
- Language: JavaScript
- Homepage: https://kaiju-9f6ba.firebaseapp.com/
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fireabse-graphql - GraphQL on Cloud Functions for Firebase
## Demo: https://kaiju-9f6ba.firebaseapp.com/
### Endpoint: https://kaiju-9f6ba.firebaseapp.com/graphql
**Step1**: Add the Firebase Admin SDK to Your Server:
```
{
"type": "",
"project_id": "",
"private_key_id": "",
"private_key": "",
"client_email": "",
"client_id": "",
"auth_uri": "",
"token_uri": "",
"auth_provider_x509_cert_url": "",
"client_x509_cert_url": ""
}
```
**Step2**: initializeApp:
```
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "YOUR_DATABASE_URL"
});
```
**Step3**: Run: ```firebase serve```
**Step4**: Enjoy!
### Example
#### Query:
```
query hotdogs{
hotdogs{
isKosher
location
name
style
website
}
}
```
#### Mutation - add:
```
mutation addHotDog(
$isKosher: Boolean
$location: String
$name: String
$style: String
$website: String
) {
addHotDog(
isKosher: $isKosher,
location: $location,
name: $name,
style: $style,
website: $website
) {
isKosher
location
name
}
}
```
#### Mutation - update:
```
mutation updateHotDog(
$token: String!,
$isKosher: Boolean
$location: String
$name: String
$style: String
$website: String
) {
updateHotDog(
token: $token
isKosher: $isKosher
location: $location
name: $name
style: $style
website: $website
) {
isKosher
location
name
}
}
```
#### Mutation - delete:
```
mutation deleteHotDog($token: String!) {
deleteHotDog(token: $token)
}
```