Created
May 16, 2017 04:23
-
-
Save mhaligowski/d01fe1d6da0e7c5da586c95f5f4efaf4 to your computer and use it in GitHub Desktop.
Handling with both Google Cloud Functions and Express
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
exports.hello = require('./hello'); |
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
module.exports = function hello(req, res) { | |
res.send('Hello'); | |
} | |
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
{ | |
"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" | |
} | |
} |
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
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