Skip to content

Starter kit for a Node/Express GraphQL server hosted by GCP functions!

License

Notifications You must be signed in to change notification settings

rjburdish/ripp-cord-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ripp-cord-cli

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.

To create and publish your own CLI:

  1. Install the ripp-cord-cli globally
npm i -g ripp-cord-cli
  1. Create a new app
ripp-cord-cli YourAppName
  1. CD into your newly created directory
cd YourAppName
(Skip step 4 if the file already exists)
  1. Create a .firebaserc
touch .firebaserc
  1. Replace the contents of .firebaserc with the following
{
  "projects": {
    "default": "YourAppName"
  }
}

To setup a new Firebase project:

The following steps will walk you through setting up a project in firebase console
  1. Make sure you have a firebase account already setup
  2. Create a new project "YourAppName" in the firebase console at:
https://console.firebase.google.com
  1. Add a new project "YourAppName"
  2. Install the firebase-tools CLI
npm i -g firebase-tools
  1. Log into Firebase
firebase login

Before running the project:

The following steps will walk you through running the project
  1. Navigate to functions > src > config> index.ts
  2. 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/"
  1. Save

To run the server

  1. Start the graphQL server locally
npm run open:dev
  1. 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

Testing the GraphQL endpoints

  1. Visit your graphIQLURL endpoint from step 12.
  2. 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
    }
}
  1. Add the Query Variables
{
  "email": "hey",
  "password": "stuff",
  "stuff": "stuff"
}
  1. Leave questions comments and feedback
  2. Enjoy!!

About

Starter kit for a Node/Express GraphQL server hosted by GCP functions!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published