forked from cs4241-19a/a4-creativecoding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
23 lines (17 loc) · 713 Bytes
/
server.js
File metadata and controls
23 lines (17 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const express = require("express");
const path = require("path");
const app = express();
require("@babel/register")({
presets: ["@babel/preset-env"]
});
import {getGeoData} from "./geo.js";
import {getPopulation} from "./population.js";
app.use(express.static("public"));
app.use(express.json()); // for parsing application/json
app.use(express.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
app.get("/",function(req,res) {
res.sendFile(path.join(__dirname+"/views/index.html"));
});
app.get("/getGeoData", getGeoData);
app.get("/getPopulation", getPopulation);
app.listen(process.env.PORT || 8000, () => console.log(`Listening on port ${process.env.PORT || 8000}!`));