Node.js-Stripe-Shopping-Cart icon indicating copy to clipboard operation
Node.js-Stripe-Shopping-Cart copied to clipboard

Render ejs not working

Open Jazour11 opened this issue 3 years ago • 2 comments

Hello,

I have having a similar issue to Khushbu11-web. Everything is fully functional until I switch the store.html file to ejs. Once I do this it says cannot GET /store.html in localhost 3000. I did check, and I am using app.set('view engine','ejs'). Any help would be greatly appreciated.

Jazour11 avatar Mar 16 '21 14:03 Jazour11

Hello,

I have having a similar issue to Khushbu11-web. Everything is fully functional until I switch the store.html file to ejs. Once I do this it says cannot GET /store.html in localhost 3000. I did check, and I am using app.set('view engine','ejs'). Any help would be greatly appreciated.

try http://localhost:3000/store

vitustockholm avatar Jul 23 '21 05:07 vitustockholm

You are needed to write this code into server.js. Sorry for my previously message. You are nedded only add this code in server.js: app.get('/store', function(req, res) { fs.readFile('items.json', function(error, data) { if (error) { res.status(500).end() } else { res.render('store.ejs', { stripePublicKey: stripePublicKey, items: JSON.parse(data) }) } }) })

ukicomputers avatar Aug 30 '21 13:08 ukicomputers