-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
37 lines (27 loc) · 894 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
"use strict";
require('dotenv').config();
const express = require("express");
const bodyParser = require("body-parser");
const routeUsers = require("./routes/routeUsers");
const routeReviews = require("./routes/routeReviews")
var app = express();
var host = "127.0.0.1";
var port = 3000;
var startPage = "index.html";
app.use(express.static("./public"));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
routeUsers.routeUsers(app);
routeReviews.routeReviews(app);
function gotoIndex(req, res) {
console.log(req.params);
res.sendFile(__dirname + "/" + startPage);
}
app.get("/" + startPage, gotoIndex);
app.route("/");
var server = app.listen(port, host, function() {
var host = server.address().address;
var port = server.address().port;
console.log("App started at http://%s:%s", host, port);
console.log("Woohoooo! 👻");
});