Netlify TOML 文件中的默认路径设置
Default Path Setting in Netlify TOML file
我有 Angular-JS 应用程序和 nodeJS 后端。我想将我的站点部署到不支持在后端部署 nodeJS 的 Netlify。这就是为什么我在 toml 文件中配置“app.set”和“app.use”信息但不知道如何操作的原因。
有人可以帮忙吗?
NodeJS 代码
// view engine setup
app.set('views', path.join(__dirname, '../frontend/views'));
app.set('view engine', 'ejs');
app.use(logger('dev'));
// Use the passport package in our application
app.use(passport.initialize());
require('./../frontend/config/passport')(passport);
app.use('/api/admin/banners/',bannersApi);
app.use('/api/vendor/cms/',cmsApi);
app.use('/api/ebay', eBayApi);
app.get('/admin', (req, res, next) => {
res.render('admin/index', { title: "Chirp"});
});
app.get('/admin/*', (req, res, next) => {
res.render('admin/index', { title: "Chirp"});
});
netlify.toml
[build]
# This is the directory to change to before starting a build.
base = "frontend/"
# NOTE: This is where we will look for package.json/.nvmrc/etc, not root.
# This is the directory that you are publishing from (relative to root of your repo)
publish = "frontend/"
# This will be your default build command
# command = "gulp"
# A basic redirects rule
[[redirects]]
from = "/*"
to = "/index.ejs"
status = 200
force = true
在我看来,您正在尝试将服务器应用程序部署到仅支持客户端应用程序的 netlify。如果您希望后端功能与您的客户端应用程序绑定,您可以使用他们的 functions
产品。
我有 Angular-JS 应用程序和 nodeJS 后端。我想将我的站点部署到不支持在后端部署 nodeJS 的 Netlify。这就是为什么我在 toml 文件中配置“app.set”和“app.use”信息但不知道如何操作的原因。 有人可以帮忙吗?
NodeJS 代码
// view engine setup
app.set('views', path.join(__dirname, '../frontend/views'));
app.set('view engine', 'ejs');
app.use(logger('dev'));
// Use the passport package in our application
app.use(passport.initialize());
require('./../frontend/config/passport')(passport);
app.use('/api/admin/banners/',bannersApi);
app.use('/api/vendor/cms/',cmsApi);
app.use('/api/ebay', eBayApi);
app.get('/admin', (req, res, next) => {
res.render('admin/index', { title: "Chirp"});
});
app.get('/admin/*', (req, res, next) => {
res.render('admin/index', { title: "Chirp"});
});
netlify.toml
[build]
# This is the directory to change to before starting a build.
base = "frontend/"
# NOTE: This is where we will look for package.json/.nvmrc/etc, not root.
# This is the directory that you are publishing from (relative to root of your repo)
publish = "frontend/"
# This will be your default build command
# command = "gulp"
# A basic redirects rule
[[redirects]]
from = "/*"
to = "/index.ejs"
status = 200
force = true
在我看来,您正在尝试将服务器应用程序部署到仅支持客户端应用程序的 netlify。如果您希望后端功能与您的客户端应用程序绑定,您可以使用他们的 functions
产品。