This commit is contained in:
Jonny_Bro (Nikita) 2023-05-25 14:07:48 +05:00
parent 26702fef6f
commit 9bb4d00a0a
4 changed files with 16 additions and 2 deletions

View file

@ -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")

View file

@ -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
View file

@ -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",

View file

@ -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",