-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.js
30 lines (23 loc) · 804 Bytes
/
app.js
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
const express = require("express");
const app = express();
const userModeling = require("./userModeling");
const twitter = require("./twitter");
const cfenv = require("cfenv");
const appEnv = cfenv.getAppEnv();
const bodyParser = require("body-parser");
app.use(bodyParser.json({limit: "50mb"}));
app.use(bodyParser.urlencoded({limit: "50mb", extended: true}));
// Configure static folder.
const path = require("path");
app.use(express.static(path.join(__dirname, "public")));
// Handle Routes.
app.get("/", function(req, res) {
res.render("index");
});
app.get("/results", function(req, res) {
res.render("results");
});
app.post("/model",userModeling.model);
app.get("/tweet",twitter.tweet);
app.listen(appEnv.port, appEnv.bind);
console.log(`App started on ${appEnv.bind}: ${appEnv.port}`);