gpt4 book ai didi

javascript - 使用feathersjs 设置生产

转载 作者:行者123 更新时间:2023-12-01 00:46:59 26 4
gpt4 key购买 nike

我想构建我的featherjs应用程序用于生产。我正在使用feathersjs和vuejs。

根据https://docs.feathersjs.com/api/configuration.html ,有一个default.json和product.json。我可以输入 Production.json 的主机和端口。

我不知道如何更改 app.js 以使用此 production.json。

这是app.js

const path = require('path');
const favicon = require('serve-favicon');
const compress = require('compression');
const helmet = require('helmet');
const cors = require('cors');
const logger = require('./logger');

const feathers = require('@feathersjs/feathers');
const configuration = require('@feathersjs/configuration');
const express = require('@feathersjs/express');
const socketio = require('@feathersjs/socketio');


const middleware = require('./middleware');
const services = require('./services');
const appHooks = require('./app.hooks');
const channels = require('./channels');

const mongoose = require('./mongoose');

const authentication = require('./authentication');

const app = express(feathers());

// Load app configuration
app.configure(configuration());
// Enable security, CORS, compression, favicon and body parsing
app.use(helmet());
app.use(cors());
app.use(compress());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(favicon(path.join(app.get('public'), 'favicon.ico')));
// Host the public folder
app.use('/', express.static(app.get('public')));

如何构建用于生产的feathersjs?

最佳答案

根据docs ,它会搜索 NODE_ENV 环境变量:

production.json files override default.json when in production mode by setting NODE_ENV=production.

关于javascript - 使用feathersjs 设置生产,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57282714/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com