Skip to content

DevSecure-Innovations/zoris-api-backend

Repository files navigation

Zoris-Backend

To install dependencies:

bun install

To run:

bun run index.ts

This project was created using bun init in bun v1.3.11. Bun is a fast all-in-one JavaScript runtime.

Don't use npm i to install dependencies it will create ambiguities.

Google Cloud Setup

To make this project functiuonally run you will need couple of google cloud api and services enabled

APIs:

Services:

Go your Gooogle Cloud Console & open the cloud shell. Now, to get your Project ID run:

gcloud config get-value project
  • Create a topic named gmail-notifications:
gcloud pubsub topics create gmail-notifications
gcloud pubsub topics add-iam-policy-binding gmail-notifications \
  --member="serviceAccount:gmail-api-push@system.gserviceaccount.com" \
  --role="roles/pubsub.publisher"
  • Create a Pub/Sub Subscription to the Server's Webhook Endpoint:
gcloud pubsub subscriptions create gmail-notifications-sub \
  --topic=gmail-notifications \
  --push-endpoint=https://yourdomain.com/webhook/gmail

NOTES

The --push-endpoint can't be localhost:XXXX/webhook/gmail it has to be a live URL, so to get one forward the port via some service (e.g. ngrok)

If you already have set the --push-endpoint and want to modify it, then follow to below steps

  • Remove the Pub/Sub Subscription first:
gcloud pubsub subscriptions delete gmail-notifications-sub
  • Recreate a Pub/Sub Subscription to the Server's Webhook Endpoint:
gcloud pubsub subscriptions create gmail-notifications-sub \
  --topic=gmail-notifications \
  --push-endpoint=https://yourdomain.com/webhook/gmail

Contributors