-
Notifications
You must be signed in to change notification settings - Fork 4
/
server.js
42 lines (34 loc) · 825 Bytes
/
server.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
31
32
33
34
35
36
37
38
39
40
41
42
// IMPORTs
require("dotenv").config();
const express = require("express");
const cors = require("cors");
//init express
const app = express();
// body parser
app.use(express.json());
// cors
app.use(
cors({
origin: "*",
})
);
// express static files
app.use(express.static("public"));
// setting view engine
app.set("views", "./views");
app.set("view engine", "ejs");
// serving ejs file
app.get("/", (req, res) => {
res.render("index");
});
app.get("/accumulation", (req, res) => {
res.render(__dirname + "/views/accumulation.ejs");
});
app.get("/charts/:symbol", (req, res) => {
res.render(__dirname + "/views/charts.ejs", { symbol: req.params.symbol });
});
// listen on process.env.PORT
const PORT = process.env.PORT;
app.listen(PORT, () => {
console.info(`Server running on PORT : ${PORT}`);
});