-
Notifications
You must be signed in to change notification settings - Fork 3
/
server.js
executable file
·58 lines (41 loc) · 1.74 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
///////////////////////////////// REQUIRE //////////////////////////////////
var express = require('express');
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
//heroku version--------------------------------------
// mongoose.connect(process.env.MONGOLAB_MAROON_URI ||'mongodb://localhost/getprojecthunt');
//localhost version------------------------------------------------
mongoose.connect('mongodb://localhost/projects');
//comment for commit
var uploadProj = require('./routes/uploadProj');
var homeProj = require('./routes/home');
var login = require('./routes/login');
var register = require('./routes/register');
var gitlog = require('./routes/gitlog');
var user = require('./routes/login');
////////////////////////////// APP USE /////////////////////////////////////s
var app = express();
app.use(express.static('public'));
app.use(express.static('node_modules'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
//my auth middleware -> takes my projectHuntGenertedToken and returns access_token (if found)
//uploadProj - checks - do i have access_token? if i do -> perform user ajax request. else -> redirect to login
app.use('/dashboard',/*[my auth middlewawre]*/ uploadProj);
app.use('/home', homeProj);
app.use('/gitlog', gitlog);
app.use('/login', user);
app.use('/user', user);
app.get('/', function(req, res, next){
res.sendFile('index.html');
});
// app.get('/user', [middlleware], function(req, res, next){
// if !cookie -> login
// else
// })
// app.post('/register', function(req, res, next){
// next("helloooooo handsome");
// });
//comment to commit
app.listen(process.env.PORT || '4000');
// app.listen(port);