Netlify does not have a website backend structure like nodejs. Nodejs is used for the build environment during the CI/CD workflow to build the site being deployed to Netlify.
A MERN stack would not be supported on Netlify. You would not be able to host the app.js
solution on Netlify, but I do have a partial solution for you to create a static site from your example repository.
Partial Solution
Create a script to build your page using node and ejs at the time of the Netlify build.
/build.js
const fs = require("fs");
const path = require("path");
const ejs = require("ejs");
function ejs2html({ path, outPath, data, options }) {
fs.readFile(path, "utf8", function(err, data) {
if (err) {
console.log(err);
return false;
}
ejs.renderFile(path, data, options, (err, html) => {
if (err) {
console.log(err);
return false;
}
fs.writeFile(outPath, html, function(err) {
if (err) {
console.log(err);
return false;
}
return true;
});
});
});
}
ejs2html({
path: `${__dirname}/views/index.ejs`,
outPath: `${__dirname}/public/index.html`
});
This script will build an index.html static page for your site into the public folder and you can then use it to deploy a static version of the ejs view for index.ejs.
The /netlify.toml
could be used as:
[build]
command = "node ./build.js"
publish = "public"
Caveats
This is not a MERN stack site deployed to Netlify. It is a static generated site using ejs
.