-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
31 lines (26 loc) · 1001 Bytes
/
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
const express = require('express')
const cors = require('cors')
const logger = require('morgan')
const bodyParser = require('body-parser')
const path = require('path')
const AuthRouter = require('./routes/AuthRouter')
const ReviewRouter = require('./routes/ReviewRouter')
const UserRouter = require('./routes/UserRouter')
const AlbumRouter = require('./routes/AlbumRouter')
const app = express()
const PORT = process.env.PORT || 3001
app.use(cors())
app.use(logger('dev'))
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }))
app.use('/api/auth', AuthRouter)
app.use('/api/reviews', ReviewRouter)
app.use('/api/users', UserRouter)
app.use('/api/albums', AlbumRouter)
// if (process.env.NODE_ENV === 'production') {
// app.use(express.static(path.join(__dirname, 'client/build')))
// app.get('*', (req, res) => {
// res.sendFile(path.join(`${__dirname}/client/build/index.html`))
// })
// }
app.listen(PORT, () => console.log(`Server Running On Port: ${PORT}`))