Skip to content

Instantly share code, notes, and snippets.

@mhaligowski
Created May 16, 2017 04:23
Show Gist options
  • Save mhaligowski/d01fe1d6da0e7c5da586c95f5f4efaf4 to your computer and use it in GitHub Desktop.
Save mhaligowski/d01fe1d6da0e7c5da586c95f5f4efaf4 to your computer and use it in GitHub Desktop.
Handling with both Google Cloud Functions and Express
exports.hello = require('./hello');
module.exports = function hello(req, res) {
res.send('Hello');
}
{
"name": "functions-with-express",
"version": "1.0.0",
"description": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Mateusz Haligowski",
"license": "ISC",
"dependencies": {
"express": "^4.15.2"
}
}
var express = require('express');
var app = express();
var hello = require('./hello.js');
app.get('/hello', hello);
app.listen(3000, function() {
console.log('Listening...');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment