-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
37 lines (28 loc) · 996 Bytes
/
index.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
//======<requirements>===========
var ip = require('ip'),
express = require('express'),
request = require('request'),
bodyParser = require('body-parser'),
methodOverride = require('method-override'),
expressSanitizer = require('express-sanitizer');
//======</requirements>===========
//=======<APP SETUP>========
var app = express();
app.set("view engine", "ejs"); //use embeded-javascript
app.use(express.static(__dirname + '/public')); //use public directory to server staic files
app.use(bodyParser.urlencoded({
extended: true
})); // use body parser
app.use(methodOverride("_method")); //override methods of form (put/delete)
app.use(expressSanitizer());
//=======</APP SETUP>========
//any route we havent defined
app.get("*", function (req, res) {
res.send("yo")
});
//port listener
app.listen('3001', ip.address(), function () {
console.log("SERVER STARTED!!!");
var address = ip.address() + ":3000";
console.log("goto -> " + address);
});