With the rise in popularity of serverless architectures and graphQL endpoints it can be overwhelming sifting through the thousands of articles and tutorials just to create your first app. We have decided to create a quick bootstrap CLI to help you streamline the reduntant parts of creating a GraphQL server and get straight to the good parts!
This project will allow you to easily get started with the a lightweight GraphQL Server hosted in Node.
- Install the ripp-cord-cli globally
npm i -g ripp-cord-cli
- Create a new app
ripp-cord-cli YourAppName
- CD into your newly created directory
cd YourAppName
- Create a .firebaserc
touch .firebaserc
- Replace the contents of .firebaserc with the following
{
"projects": {
"default": "YourAppName"
}
}
- Make sure you have a firebase account already setup
- Create a new project "YourAppName" in the firebase console at:
https://console.firebase.google.com
- Add a new project "YourAppName"
- Install the firebase-tools CLI
npm i -g firebase-tools
- Log into Firebase
firebase login
- Navigate to functions > src > config> index.ts
- Update the endpoint URL with your project name
endpointURL: "/YourAppName/us-central1/api/graphql/"
graphIQLURL: "/YourAppName/us-central1/api/graphiql/"
schemaURL: "/YourAppName/us-central1/api/schema/"
- Save
- Start the graphQL server locally
npm run open:dev
- Clean the project
npm run clean
Please note If you're graphQL is failing please verify that the endpoint URL in step 12 matches the endpoint in the console output after running step 14
- Visit your graphIQLURL endpoint from step 12.
- Execute the following querys in the graphQL window:
mutation saveStuff($email:String!, $password: String!){
saveStuff(email: $email, password:$password) {
message
}
}
query stuff{
getStuff{
message
}
}
query otherStuff($stuff:String){
getOtherStuff(stuff: $stuff){
message
}
}
- Add the Query Variables
{
"email": "hey",
"password": "stuff",
"stuff": "stuff"
}
- Leave questions comments and feedback
- Enjoy!!