mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 13:14:58 +05:00
fix cors
This commit is contained in:
parent
26702fef6f
commit
9bb4d00a0a
4 changed files with 16 additions and 2 deletions
|
@ -6,6 +6,7 @@ module.exports.init = async(client) => {
|
||||||
/* Init express app */
|
/* Init express app */
|
||||||
const express = require("express"),
|
const express = require("express"),
|
||||||
session = require("express-session"),
|
session = require("express-session"),
|
||||||
|
cors = require("cors"),
|
||||||
path = require("path"),
|
path = require("path"),
|
||||||
app = express();
|
app = express();
|
||||||
|
|
||||||
|
@ -24,6 +25,7 @@ module.exports.init = async(client) => {
|
||||||
// For post methods
|
// For post methods
|
||||||
.use(express.json())
|
.use(express.json())
|
||||||
.use(express.urlencoded({ extended: true }))
|
.use(express.urlencoded({ extended: true }))
|
||||||
|
.use(cors())
|
||||||
// Set the engine to html (for ejs template)
|
// Set the engine to html (for ejs template)
|
||||||
.engine("html", require("ejs").renderFile)
|
.engine("html", require("ejs").renderFile)
|
||||||
.set("view engine", "ejs")
|
.set("view engine", "ejs")
|
||||||
|
|
|
@ -2,8 +2,6 @@ const express = require("express"),
|
||||||
router = express.Router();
|
router = express.Router();
|
||||||
|
|
||||||
router.get("/", function (req, res) {
|
router.get("/", function (req, res) {
|
||||||
res.set("Access-Control-Allow-Origin", "*");
|
|
||||||
|
|
||||||
res.render("docs", {
|
res.render("docs", {
|
||||||
user: req.userInfos,
|
user: req.userInfos,
|
||||||
translate: req.translate,
|
translate: req.translate,
|
||||||
|
|
13
package-lock.json
generated
13
package-lock.json
generated
|
@ -16,6 +16,7 @@
|
||||||
"canvacord": "^5.1.0",
|
"canvacord": "^5.1.0",
|
||||||
"canvas": "^2.10.2",
|
"canvas": "^2.10.2",
|
||||||
"chalk": "^4.1.2",
|
"chalk": "^4.1.2",
|
||||||
|
"cors": "^2.8.5",
|
||||||
"cron": "^2.1.0",
|
"cron": "^2.1.0",
|
||||||
"discord-giveaways": "^6.0.1",
|
"discord-giveaways": "^6.0.1",
|
||||||
"discord-player": "^6.2.1",
|
"discord-player": "^6.2.1",
|
||||||
|
@ -1247,6 +1248,18 @@
|
||||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
||||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
|
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
|
||||||
},
|
},
|
||||||
|
"node_modules/cors": {
|
||||||
|
"version": "2.8.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||||
|
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||||
|
"dependencies": {
|
||||||
|
"object-assign": "^4",
|
||||||
|
"vary": "^1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/cron": {
|
"node_modules/cron": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/cron/-/cron-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/cron/-/cron-2.3.0.tgz",
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
"canvacord": "^5.1.0",
|
"canvacord": "^5.1.0",
|
||||||
"canvas": "^2.10.2",
|
"canvas": "^2.10.2",
|
||||||
"chalk": "^4.1.2",
|
"chalk": "^4.1.2",
|
||||||
|
"cors": "^2.8.5",
|
||||||
"cron": "^2.1.0",
|
"cron": "^2.1.0",
|
||||||
"discord-giveaways": "^6.0.1",
|
"discord-giveaways": "^6.0.1",
|
||||||
"discord-player": "^6.2.1",
|
"discord-player": "^6.2.1",
|
||||||
|
|
Loading…
Reference in a new issue