mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-10 21:47:02 +03:00
Fixed CORS issues
This commit is contained in:
7
index.js
7
index.js
@@ -14,6 +14,13 @@ var db = new sqlite3.Database('./databases/sponsorTimes.db');
|
|||||||
// Create an HTTP service.
|
// Create an HTTP service.
|
||||||
http.createServer(app).listen(80);
|
http.createServer(app).listen(80);
|
||||||
|
|
||||||
|
//setup CORS correctly
|
||||||
|
app.use(function(req, res, next) {
|
||||||
|
res.header("Access-Control-Allow-Origin", "*");
|
||||||
|
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
//add the get function
|
//add the get function
|
||||||
app.get('/api/getVideoSponsorTimes', function (req, res) {
|
app.get('/api/getVideoSponsorTimes', function (req, res) {
|
||||||
let videoID = req.query.videoID;
|
let videoID = req.query.videoID;
|
||||||
|
|||||||
Reference in New Issue
Block a user