const express = require('express') const bodyParser = require('body-parser') const { vueRenderer } = require('@doweb/vuexpress') const app = express() // Allow JSON API app.use(bodyParser('json')) // Enable static files app.use(express.static('public')) // Set up VueXpress let options = { views: './views', cache: true, watch: process.env.NODE_ENVIRONMENT == 'dev', metaInfo: { title: 'Seance', }, extractCSS: true, cssOutputPath: 'css/styles.css', publicPath: 'public', } const renderer = vueRenderer(options) app.use(renderer) // Views app.get('/', (req, res) => { res.render('index', { message: 'Hey, welcome to Seance!' }) }) app.get('/api/', (req, res) => { res.json({ status: 'success', message: 'Welcome to the Seance API :)', }) }) const port = process.env.PORT || 4000 app.listen(port, () => { console.log(`Listening on ${port}`) })