Skip to content

Instantly share code, notes, and snippets.

@jamesasu
Created April 17, 2024 03:26
Show Gist options
  • Save jamesasu/a47d23cd92c96ce8c0d71c140ab8a18b to your computer and use it in GitHub Desktop.
Save jamesasu/a47d23cd92c96ce8c0d71c140ab8a18b to your computer and use it in GitHub Desktop.
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