Code Monkey home page Code Monkey logo

vue-apollo-firebase-functions's Introduction

Vue Apollo Firebase Functions

Example project using a Vue frontend to send data an Apollo GraphQL server based in a cloud function on Firebase. Check out the demo!

Local Development

Clone the repo and download dependencies. Dependencies will need to be downloaded in two locations; the repo root and the functions directory. nvm is used in the functions directory because Firebase cloud functions run on node v8.14.0 and don't give you an option to use a later version. npm must also be used in the functions directory for most tasks.

yarn
cd functions
npm i

After dependencies are downloaded, start the frontend server and Firebase functions emulator.

yarn serve
cd functions
npm run serve

You can then navigate to http://localhost:8080 and changes made will be reflected on save. The emulated cloud function is located at http://localhost:5000/vue-apollo-firebase-functions/us-central1/api/graphql and includes a GraphQL playground. Make sure you change the url inside the playground for it to work properly!

Build & Deploy

The first step is to create a new project in Firebase. It is free to host a simple cloud function with a couple gotchas; strict rate limits and no access to the outside internet from inside the function. It's limiting but perfect for getting started.

After your project is created run yarn firebase login from the repo root. After you have logged in to the Firebase cli you then need to change instances of vue-apollo-firebase-functions throughout the project to the id of your new project. I recommend running a find and replace.

After the urls are updated simply run yarn deploy and wait for the deployment to Firebase to complete! By default it will deploy both the frontend and function in one go.

vue-apollo-firebase-functions's People

Contributors

danielwaltz avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.