What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-20 09:13:09
Get requests return html code instead of real data
// use this after route not before route if (process.env.NODE_ENV === 'production') { app.use(express.static(resolve(process.cwd(), 'client/build'))) app.get('*', (req, res) => { res.sendFile(resolve(process.cwd(), 'client/build/index.html')) ... Add solution -
Javascript 2021-09-21 18:13:02
API requests return index.html in production
// use this after route not before route if (process.env.NODE_ENV === 'production') { app.use(express.static(resolve(process.cwd(), 'client/build'))) app.get('*', (req, res) => { res.sendFile(resolve(process.cwd(), 'client/build/index.html')) ... Add solution -
Javascript 2021-09-18 10:59:03
nodejs response is html not json data
// use this after route not before route if (process.env.NODE_ENV === 'production') { app.use(express.static(resolve(process.cwd(), 'client/build'))) app.get('*', (req, res) => { res.sendFile(resolve(process.cwd(), 'client/build/index.html')) ... Add solution -
Javascript 2021-09-17 20:29:02
'@babel/plugin-proposal-class-properties' webpack
const path = require('path'); const webpack = require('webpack'); module.exports = { target: 'node', mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', entry: [ './src/index.js' ], output: { path: path.resolve(__dirna... Add solution -
Javascript 2021-09-13 18:26:02
heroku get requests return html code in production
// use this after route not before route if (process.env.NODE_ENV === 'production') { app.use(express.static(resolve(process.cwd(), 'client/build'))) app.get('*', (req, res) => { res.sendFile(resolve(process.cwd(), 'client/build/index.html')) ... Add solution