router.get("/*", function (req, res, next) {
res.render("index", { title: "My App" })
})
What is this code block doing? Is it rendering the index.ejs file? One more thing, how is /* will be handled by react routers?
Also could you clarify my doubts on node environment?
In package.json, I have this:
"scripts": {
"start": "NODE_ENV=development nodemon ./bin/www",
"webpack": "webpack-dev-server --config ./webpack.config.js --mode development"
},
In app.js:
if (process.env.NODE_ENV === "development") {
const webpack = require("webpack")
const webpackConfig = require("./webpack.config")
const compiler = webpack(webpackConfig)
app.use(
require("webpack-dev-middleware")(compiler, {
noInfo: true,
publicPath: webpackConfig.output.publicPath,
})
)
app.use(require("webpack-hot-middleware")(compiler))
}
I'm confused on how webpack is working here. I know it generates a bundle but how it's working with env is just that I could not understand.
Sorry for asking too many questions.