-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
31 lines (24 loc) · 954 Bytes
/
server.js
File metadata and controls
31 lines (24 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var express = require('express');
var app = express();
// set the port of our application
// process.env.PORT lets the port be set by Heroku
var port = process.env.PORT || 8080;
// set the view engine to ejs
app.set('view engine', 'ejs');
// make express look in the public directory for assets (css/js/img)
app.use(express.static(__dirname + '/public'));
// set the home page route
app.get('/', function(req, res) {
// ejs render automatically looks in the views folder
//res.render('index');
res.json({ fulfillmentText: 'This is a sample response from your webhook!' });
});
app.post('/', function(req, res){
res.json({ fulfillmentText: 'This is a sample response from your webhook!' });
});
app.listen(port, function() {
console.log('Our app is running on http://localhost:' + port);
});
exports.helloHttp = function helloHttp (request, response) {
response.json({ fulfillmentText: 'This is a sample response from your webhook!' });
};