I have this code below which is my app.js in my node server currently my website has some CORS issue when downloading the canvas with HTML2Canvas. But i'm not sure why even after adding the CORS header it still doesn't work, Am i doing something wrong in my code below? Any help would be greatly appreciated thank you.
const express = require('express');
const cors = require('cors')
const path = require('path');
const bodyParser = require('body-parser')
const app = express();
app.options('/home', cors())
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug');
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(bodyParser.json())
app.use(express.static(path.join(__dirname, 'public')));
app.get('/', function(req, res){
res.render('index');
})
app.get('/home', function(req, res){
res.render('home');
})
app.listen(3000, function(){
console.log('Server started on port 3000...');
});