forked from sawolabs/nodejs-sample-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
25 lines (19 loc) · 617 Bytes
/
Copy pathindex.js
File metadata and controls
25 lines (19 loc) · 617 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
//entry point for the app
const express = require("express");
require("dotenv").config();
const app = express();
const path = require("path");
app.use(express.static(path.join(__dirname, "public")));
app.get("/", (req, res) => {
res.sendFile(__dirname + "/index.html");
});
app.get("/login", (req, res) => {
res.sendFile(__dirname + "/public/login.html", {
apiKey: process.env.SAWO_API_KEY,
});
});
app.get("/success", (req, res) => {
res.sendFile(__dirname + "/public/success.html");
});
const port = process.env.PORT || 3000;
app.listen(port, console.log("Listening on port" + process.env.HOST));