gancio-upstream/server.js
2019-02-26 14:08:24 +01:00

21 lines
843 B
JavaScript

const express = require('express')
const app = express()
const bodyParser = require('body-parser')
const api = require('./app/api')
const cors = require('cors')
const path = require('path')
const port = process.env.PORT || 8080
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
app.use(cors())
app.use('/static', express.static(path.join(__dirname, 'uploads')))
app.use('/uploads', express.static('uploads'))
app.use('/api', api)
app.use('/', express.static(path.join(__dirname, 'client', 'dist')))
app.use('/css', express.static(path.join(__dirname, 'client', 'dist', 'css')))
app.use('/js', express.static(path.join(__dirname, 'client', 'dist', 'js')))
app.use('*', express.static(path.join(__dirname, 'client', 'dist', 'index.html')))
app.listen(port)
console.log('Magic happens at http://localhost:' + port)