I am trying to get a nuxt with express web app deployed to an Azure Web App running Node. Here's what I have done so far:
Sat Aug 26 2017 16:12:45 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
SyntaxError: Unexpected token {
at Module._compile (module.js:434:25)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object.<anonymous> (D:\Program Files\iisnode\interceptor.js:459:1)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
Here are the contents of the server.js file I created based on the notes in 3:
const fs = require('fs');
const { Nuxt } = require('nuxt');
const resolve = require('path').resolve;
const rootDir = resolve('.');
const nuxtConfigFile = resolve(rootDir, 'nuxt.config.js');
let options = {};
if (fs.existsSync(nuxtConfigFile)) {
options = require(nuxtConfigFile);
}
if (typeof options.rootDir !== 'string') {
options.rootDir = rootDir;
}
options.dev = false; // Force production mode (no webpack middleware called)
const nuxt = new Nuxt(options);
const port = process.env.PORT;
const host = process.env.HOST;
nuxt.listen(port, host);
If need be I can give you the web.config and iisnode.yml files if those would be helpful when looking at the config of the azure web app.
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1326">#c1326</a>)</em></sub></div>