const express = require('express');
const consola = require('consola');
const { Nuxt, Builder } = require('nuxt');
const app = express();
// Import and Set Nuxt.js options
let config = require('../nuxt.config');
config.dev = !(process.env.NODE_ENV === 'production');
app.set('port', config.server.port);
async function start() {
// Init Nuxt.js
const nuxt = new Nuxt(config);
// Build only in dev mode
if (config.dev) {
const builder = new Builder(nuxt);
await builder.build()
}
// Give nuxt middleware to express
app.use(nuxt.render);
// Listen the server
app.listen(config.server.port, config.server.host);
consola.ready({
message: `Сервер слушает http://${config.server.host}:${config.server.port}`,
badge: true
})
}
start();
...
"scripts": {
"dev-docker": "nodemon server/index.js -e js,graphql,gql",
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start --production",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"precommit": "npm run lint"
},
...
server {
listen %ip%:%httpport%;
server_name secure.cc.local;
...
server {
listen %ip%:%httpport%;
server_name secure.cc.local;
access_log "%sprogdir%/logs/cc.local.access.log";
error_log "%sprogdir%/logs/cc.local.error.log";
add_header "Access-Control-Allow-Origin" "*";
add_header "Access-Control-Allow-Headers" "Origin, X-Requested-With, Content-Type, Accept, Authorization";
add_header "Access-Control-Request-Methods" "GET, POST, OPTIONS";
location / {
proxy_pass http://127.0.0.100:8090;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}
docker-compose up -d
В самом начале процедуры я выставляю его в "0"
Я опустил эту часть кода.