-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
41 lines (33 loc) · 818 Bytes
/
server.js
File metadata and controls
41 lines (33 loc) · 818 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var express=require('express');
var app=express();
var bodyParser=require('body-parser');
var http=require('http');
var server=http.createServer(app);
var application_root=__dirname,
path=require('path');
app.use(bodyParser());
app.use(express.static(application_root));
app.get('/',function(req,res)
{
res.sendfile('login.html');
});
app.get('/home',function(req,res)
{
res.sendfile('home.html');
});
app.get('/login',function(req,res)
{
res.sendfile('login.html');
});
app.post('/login',function(req,res)
{
var passed_name=req.body.name;
var passed_pass=req.body.password;
console.log(passed_name);
console.log(passed_pass);
//do something with the passed values from form
res.sendfile('home.html');
});
var port=process.env.PORT || 5000;
server.listen(port);
console.log("Listening on "+port);