meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ixc2024:tech:tools:backendoftheapplication [2024/05/27 17:00] – hibaa | ixc2024:tech:tools:backendoftheapplication [2024/05/27 18:55] (current) – hibaa | ||
---|---|---|---|
Line 171: | Line 171: | ||
npm install firebase-admin | npm install firebase-admin | ||
- | **Initialize Firebase Admin SDK** | + | -> **Initialize Firebase Admin SDK** |
In Visual Studio, open the folder you have been working on (In this example it is Waste-Backend), | In Visual Studio, open the folder you have been working on (In this example it is Waste-Backend), | ||
Line 190: | Line 190: | ||
| | ||
- | **Creating Express.js Server with Authentication Endpoints** | + | -> **Creating Express.js Server with Authentication Endpoints** |
Create a file named index.js in your projects root directory and enter the code below: | Create a file named index.js in your projects root directory and enter the code below: | ||
Line 250: | Line 250: | ||
This will allow you to create endpoints that can be used by the frontend to send or access data. The following URLs can be used to access the different endpoints. | This will allow you to create endpoints that can be used by the frontend to send or access data. The following URLs can be used to access the different endpoints. | ||
- | -> Additional resources on how to use firebase authentication with your backend and frontend can be found in the // | + | __Note: |
==Deploying API Service to Google Cloud == | ==Deploying API Service to Google Cloud == | ||
- | **Create app.yaml** | + | -> **Create app.yaml** |
To deploy the app we need to create a configuration file in our project' | To deploy the app we need to create a configuration file in our project' | ||
Line 262: | Line 262: | ||
# [START app_yaml] | # [START app_yaml] | ||
| | ||
- | service: node-express-api | + | entrypoint: node index.js |
# [END app_yaml] | # [END app_yaml] | ||
- | **Explanation of the Configuration:** | + | __Notes:__ |
* runtime: Specifies the runtime environment (e.g., nodejs20) | * runtime: Specifies the runtime environment (e.g., nodejs20) | ||
* service: Defines the service name, typically a project-specific prefix or subdomain. | * service: Defines the service name, typically a project-specific prefix or subdomain. | ||
+ | * entrypoint: By default App Engine expects server.js as the entry point but if your app uses anything else then you specify that here. | ||
- | **Deploy your App Locally** | + | -> **Deploy your App Locally** |
- | Deploy your Node app by executing the command in root directory of your project | + | - Close your command prompt and open it again |
+ | - Run **' | ||
+ | - Navigate to your project folder **'cd waste-backend' | ||
+ | - Run the command **' | ||
+ | - Select **' | ||
+ | - Select the email account that you are using in your Cloud Console to perform operations for this configuration | ||
+ | - Pick the number allocated to your project | ||
+ | - Deploy your Node app by executing the command in root directory of your project | ||
| | ||
+ | |||
+ | 5. Choose a region where you want your App Engine Application to be located | ||
====Additional Resources==== | ====Additional Resources==== |