Forked from jamesasu/google-cloud-function-with-express.js
Created
August 13, 2024 10:06
-
-
Save ejangi/1c64ed4b70fd696c5d6735bf76978af8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('@google-cloud/functions-framework'); | |
const express = require('express'); | |
const app = express(); | |
// GET /myFunction | |
app.get('/', async (req, res) => { | |
res.status(200).send('Default route'); | |
}); | |
// GET /myFunction/other | |
app.get('/other', async (req, res) => { | |
res.status(200).send('Other route!'); | |
}); | |
/* HTTP Cloud Function. | |
* | |
* @param {Object} req Cloud Function request context. | |
* @param {Object} res Cloud Function response context. | |
*/ | |
functions.http('myFunction', app); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment