Skip to content

Commit 6815a70

Browse files
committed
cleaned up
1 parent edefcbe commit 6815a70

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

routes/en.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const { pronounce } = require("node-pronounce");
66
const randomUseragent = require("random-useragent");
77
const rua = randomUseragent.getRandom();
88
var wordOfDay = [];
9+
const baseUrl = 'https://randomword.com';
910

1011
router.get("/", function (req, res) {
1112
res.header("Access-Control-Allow-Origin", "*");
@@ -20,11 +21,9 @@ router.get("/", function (req, res) {
2021
res.header("Strict-Transport-Security", "max-age=63072000");
2122
res.setHeader("Content-Type", "application/json");
2223

23-
const partOfSpeech = req.query.type;
24-
2524
axios({
2625
method: "GET",
27-
url: 'https://randomword.com',
26+
url: baseUrl,
2827
headers: {
2928
"User-Agent": rua,
3029
},
@@ -74,8 +73,6 @@ router.get("/", function (req, res) {
7473
});
7574

7675
router.get("/:pos", function (req, res) {
77-
78-
const partOfSpeech = req.params.pos;
7976
res.header("Access-Control-Allow-Origin", "*");
8077
res.header(
8178
"Access-Control-Allow-Headers",
@@ -88,9 +85,11 @@ router.get("/:pos", function (req, res) {
8885
res.header("Strict-Transport-Security", "max-age=63072000");
8986
res.setHeader("Content-Type", "application/json");
9087

88+
const partOfSpeech = req.params.pos;
89+
9190
axios({
9291
method: "GET",
93-
url: `https://randomword.com/${partOfSpeech}`,
92+
url: `${baseUrl}/${partOfSpeech}`,
9493
headers: {
9594
"User-Agent": rua,
9695
},

0 commit comments

Comments
 (0)