Starter project for create restAPI with firebase cloud function and firebase Realtime Database(RDB).
node -v
v10.9.0
- body-parser parse incoming request bodies in a middleware before your handlers, available under the req.body property.
- cors is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.
- express create restAPI.
- firebase-admin provides the tools and infrastructure you need to develop your app with admin.
- firebase-functions package provides an SDK for defining Cloud Functions for Firebase.
- config configulation file, example express firebase cors etc.
- core business logic fuction for api.
- utils utility functtion.
- index.js exporting and route for function.
1. Set up Node.js and the Firebase CLI install firebase-tools to deploy functions to the Cloud Functions runtime.
npm install -g firebase-tools
2. Login Firebase to login via the browser and authenticate the firebase tool.
firebase login
3. Initialize Firebase SDK for Cloud Functions to create dependencies for your project. You can run!
firebase init functions
1. Change Directory to functions folder
cd functions
2. Build and Run in local develop in local server running on port 5000.
npm run serve
example.
http://localhost:5000/<project-name>/<firebase-server>/helloWorld
3. Deploy function to firebase.
npm run deploy