Search code examples
node.jsangularnetlify

Default Path Setting in Netlify TOML file


I have Angular-JS app with nodeJS backend. I want to deploy my site to Netlify which do not support nodeJS deployment on back-end. Thats why I am configuring "app.set" and "app.use" information in toml file but do not know how to do it. Anyone can help please ?

NodeJS Code

// 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

Solution

  • Seems to me that you are trying to deploy a server application to netlify which only supports client apps. You could make use of their functions offering if you want backend functionality tied with your client app.