Create a GraphQL — Firebase server just with a schema. 🚀

Written by estrada9166 | Published 2018/12/13
Tech Story Tags: graphql | nodejs | javascript | firebase | create-a-graphql

TLDRvia the TL;DR App

Now you can create a GraphQL server, connected to your Firebase 🔥 database just running a command on your terminal.

How to use it:

  1. Install easygraphql-firebase:

$ npm install easygraphql-firebase -g

2. Create a GraphQL schema file with the model you want to have:

type Student {key: ID!age: Int!name: String!}

type School {key: ID!location: String!students: Int!name: String!student: Student!}

input StudentInput {age: Int!name: String!}

input SchoolInput {location: String!students: Int!name: String!phone: String!student: StudentInput!}

type Query {getStudentByUsername(name: String!): Student!getStudents: [Student!]!getSchool(name: String!): School!getSchools: [School!]!}

type Mutation {createStudent(input: StudentInput!): Student!createSchool(input: SchoolInput!): School!}

3. Run on your terminal:

$ easygraphql-firebase

And that’s it, easygraphql-firebase will do everything for you, it will create the server, resolvers, test files and more… check the video to see the result

https://www.youtube.com/watch?v=e0IEEZ1kHDY

If you want to deploy with now, be sure to have it installed and just pass the flag --now

$ easygraphql-firebase --now

If you like this package don’t forget to give a ⭐️ on GitHub.

Repo: https://github.com/EasyGraphQL/easygraphql-firebase

npm: https://www.npmjs.com/package/easygraphql-firebase

Website: https://easygraphql.com/


Published by HackerNoon on 2018/12/13