Hi,I just deployed my MERN app on heroku. I followed all the instructions and successfully deployed it but heroku cannot see the files.on the browser i'm seeing Not Found. please see link below. https://ift.tt/2H57K2i knows how i can resolve this. the MERN application is working fine on my local machine. Please see my server.js file below. Thanksconst express = require('express'); const bodyParser = require("body-parser"); const mongoose = require('mongoose'); const Admin = require('./Admin.model'); const fileUpload = require('express-fileupload'); const multer = require('multer'); const path = require('path'); const uuidv4 = require('uuid/v4'); const app = express(); const dev = app.get('env') !== 'production'; if(!dev){ app.disable('x-powered-by'); app.use(express.static(path.resolve(__dirname, 'build'))); app.get('*',(req, res)=>{ res.sendFile(path.resolve(__dirname, 'build', 'index.html')) }) }; app.use('/uploads', express.static(__dirname + '/uploads')); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); app.use('/api', require('./routes/api')); const db = "mongodb://localhost:27017/the_peel"; mongoose.connect(db); mongoose.Promise = global.Promise; const port = process.env.PORT || 8000; app.listen(port, () => console.log(`Listening on port ${port}`));
Submitted April 17, 2018 at 12:15PM by myrrtle
No comments:
Post a Comment