Initial commit

This commit is contained in:
2019-01-15 13:21:24 +01:00
commit dc50642ed9
49 changed files with 10493 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
const express = require('express');
const proxy = require('express-http-proxy');
const { Nuxt, Builder } = require('nuxt');
//const { addGraphMiddleware } = require('graph-mock');
const app = express();
const host = process.env.HOST || '127.0.0.1';
const port = process.env.PORT || 3000;
// Import and set Nuxt.js options
let config = require('../nuxt.config.js');
config.dev = process.env.NODE_ENV !== 'production';
const nuxt = new Nuxt(config);
// Start build process in dev mode
if (config.dev) {
const builder = new Builder(nuxt);
builder.build();
}
// Add graphql mocking middleware
//addGraphMiddleware(app);
app.use('/graph', proxy('localhost:8081', {
proxyReqPathResolver: function (req) {
return '/graph';
}
}
)
);
// Give nuxt middleware to express
app.use(nuxt.render);
// Start express server
app.listen(port, host);
console.log(`Server is listening on http://${host}:${port}`); // eslint-disable-line