-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
71 lines (53 loc) · 2.61 KB
/
app.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
59
60
61
62
63
64
65
66
67
68
69
70
const express = require('express')
const { engine } = require('express-handlebars');
const compression = require('compression');
const path = require('path')
const app = express()
let port = process.env.PORT || '3000';
const server = app.listen(port, () => { console.log("Περιμένω αιτήματα στο port " + port) });
const routes = require('./routes/patras--league-routes');
const model = require('./model/patras--league-model-pg-db.js');
app.use(express.static('public'))
app.engine('hbs', engine({ extname: '.hbs'}));
app.set('view engine', 'hbs');
app.use(express.urlencoded({ extended: false }));
app.use(compression()); //Compress all routes
app.use('/', routes);
// router.get('/afterregister',(req, res) => res.render('index',{style:["index"],layout:false}))
// app.use('/', router);
//app.use('/', routes); in start.js file //module.exports = router in router file and require in app.js
// app.get("/",(req, res) => {
// })
//*****************************************************************************
// app.get('/', (req, res) => {
// res.render('manager-register',{ loggedin : false , style:["modal","loginstyle","index","manager-register"]})
// });
// app.get('/', (req, res) => {
// res.render('time-selection',{loggedin:true , style: ["signed-manager-main","time-selection"]})
// });
// app.get('/', (req, res) => {
// res.render('signed-manager', { loggedin: true,mainpage : true,
// partialContext: {name: "John"},style : ["signed-manager-main"]})
// });
// app.get('/', (req, res) => {
// res.render('team-layout-management', { loggedin: true, disabled:true,teamname:"My Team" ,
// style: ["signed-manager-main","team-layout-management","alert"]})
// });
// app.post("/signup", (req, res) => {
// console.log("/", req.body.UserEmail);
// // έχει συμπληρωθεί το userName στη φόρμα
// // βρες τον χρήστη id ή δημιούργησε χρήστη αν δεν υπάρχει
// const newuser = {"email":req.body.UserEmail, "password":req.body.UserPass, "id": req.body.UserPass, "firstname":req.body.FirstName, "lastname": req.body.LastName,"address": req.body.Address,"ps": req.body.ZipCode,"phone": req.body.Phone1,"org": req.body.OrgName}
// let id="33373"
// model.addNewUser(id,newuser,(err, row) => {
// if (err){
// console.log(err.message);
// // return console.log(err.message);
// }
// console.log('POST / returned row....', row)
// res.redirect("/manager-register")}
// )});
module.exports = app;
//in start.js
// require('dotenv').config();
// const app = require('./app');