-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
42 lines (35 loc) · 1.31 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
const express = require('express');
const session = require('express-session');
const path = require('path');
const passport = require('./config/passport');
const authRoutes = require('./routes/auth');
const imageRoutes = require('./routes/image');
const userRoutes = require('./routes/userRoutes');
const adminRoutes = require('./routes/adminRoutes');
const forgotPasswordRoutes = require('./routes/forgotPassword');
const resetPasswordRoutes = require('./routes/resetPassword');
const registerRoutes = require('./routes/register');
const app = express();
const PORT = process.env.PORT || 3000;
app.use(express.static(path.join(__dirname, 'public')));
app.use('/uploads', express.static(path.join(__dirname, 'uploads')));
app.use('/node_modules', express.static(path.join(__dirname, 'node_modules')));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(session({
secret: 'secret',
resave: false,
saveUninitialized: false
}));
app.use(passport.initialize());
app.use(passport.session());
app.use('/', authRoutes);
app.use('/', imageRoutes);
app.use('/', userRoutes);
app.use('/', adminRoutes);
app.use('/', forgotPasswordRoutes);
app.use('/', resetPasswordRoutes);
app.use('/', registerRoutes);
app.listen(PORT, () => {
console.log(`Servidor corriendo en http://localhost:${PORT}`);
});