Set up skeleton server!
This commit is contained in:
parent
f31cc73cc8
commit
2353195837
4 changed files with 5915 additions and 39 deletions
21
package.json
21
package.json
|
@ -12,16 +12,35 @@
|
||||||
"seance": "cli.js"
|
"seance": "cli.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@babel/core": "^7.9.6",
|
||||||
|
"@babel/plugin-proposal-object-rest-spread": "^7.9.6",
|
||||||
|
"@doweb/vuexpress": "^1.1.3",
|
||||||
"@tryghost/admin-api": "^1.0.1",
|
"@tryghost/admin-api": "^1.0.1",
|
||||||
|
"babel-loader": "^8.1.0",
|
||||||
|
"babel-preset-env": "^1.7.0",
|
||||||
|
"body-parser": "^1.19.0",
|
||||||
"commander": "^3.0.2",
|
"commander": "^3.0.2",
|
||||||
"convict": "^5.2.0",
|
"convict": "^5.2.0",
|
||||||
|
"css-loader": "^3.5.3",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.2.0",
|
||||||
|
"express": "^4.17.1",
|
||||||
"js-yaml": "^3.13.1",
|
"js-yaml": "^3.13.1",
|
||||||
"markdown": "^0.5.0",
|
"markdown": "^0.5.0",
|
||||||
"mediumexporter": "github:badrihippo/mediumexporter#seance-latest",
|
"mediumexporter": "github:badrihippo/mediumexporter#seance-latest",
|
||||||
|
"mini-css-extract-plugin": "^0.9.0",
|
||||||
|
"node-sass": "^4.14.1",
|
||||||
|
"postcss-loader": "^3.0.0",
|
||||||
"prompt-async": "^0.9.9",
|
"prompt-async": "^0.9.9",
|
||||||
"r2": "^2.0.1",
|
"r2": "^2.0.1",
|
||||||
"rembrandt": "^0.1.3",
|
"rembrandt": "^0.1.3",
|
||||||
"webdav": "^2.10.0"
|
"sass-loader": "^8.0.2",
|
||||||
|
"vue": "^2.6.11",
|
||||||
|
"vue-loader": "^15.9.2",
|
||||||
|
"vue-template-compiler": "^2.6.11",
|
||||||
|
"vuex": "^3.3.0",
|
||||||
|
"webdav": "^2.10.0",
|
||||||
|
"webpack": "^4.43.0",
|
||||||
|
"webpack-merge": "^4.2.2",
|
||||||
|
"webpack-node-externals": "^1.7.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
42
server.js
Normal file
42
server.js
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
const express = require('express')
|
||||||
|
const bodyParser = require('body-parser')
|
||||||
|
const { vueRenderer } = require('@doweb/vuexpress')
|
||||||
|
|
||||||
|
const app = express()
|
||||||
|
|
||||||
|
app.use(bodyParser('json'))
|
||||||
|
|
||||||
|
// 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}`)
|
||||||
|
})
|
9
views/index.vue
Normal file
9
views/index.vue
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<template>
|
||||||
|
<div id="app">{{ message }}</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'Welcome to Seance',
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in a new issue