-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
33 lines (27 loc) · 1.08 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
const express = require('express');
const cors = require('cors');
const cookieParser = require('cookie-parser');
const app = express();
const path = require('path');
const filesRoutes = require('./routes/api/files.routes');
const productsRoutes = require('./routes/api/products.routes');
const categoriesRoutes = require('./routes/api/categories.routes');
const subcat = require('./routes/api/subcat.routes');
const authRoutes = require('./routes/api/auth.routes');
const adsRoutes = require('./routes/api/ads.routes');
const usersRoutes = require('./routes/api/users.routes');
app.use(express.json())
app.use(cookieParser())
app.use(cors())
app.use('/api/files', filesRoutes)
app.use('/api/products', productsRoutes)
app.use('/api/categories', categoriesRoutes)
app.use('/api/auth', authRoutes)
app.use('/api/ads', adsRoutes)
app.use('/api/users', usersRoutes)
app.use('/api/subcategories', subcat)
app.use(express.static(path.join(__dirname, 'client', 'dist')));
app.get('*', function (req, res) {
res.sendFile(path.join(__dirname, 'client', 'dist', 'index.html'));
});
module.exports = app;