@@ -6,6 +6,7 @@ const { pronounce } = require("node-pronounce");
6
6
const randomUseragent = require ( "random-useragent" ) ;
7
7
const rua = randomUseragent . getRandom ( ) ;
8
8
var wordOfDay = [ ] ;
9
+ const baseUrl = 'https://randomword.com' ;
9
10
10
11
router . get ( "/" , function ( req , res ) {
11
12
res . header ( "Access-Control-Allow-Origin" , "*" ) ;
@@ -20,11 +21,9 @@ router.get("/", function (req, res) {
20
21
res . header ( "Strict-Transport-Security" , "max-age=63072000" ) ;
21
22
res . setHeader ( "Content-Type" , "application/json" ) ;
22
23
23
- const partOfSpeech = req . query . type ;
24
-
25
24
axios ( {
26
25
method : "GET" ,
27
- url : 'https://randomword.com' ,
26
+ url : baseUrl ,
28
27
headers : {
29
28
"User-Agent" : rua ,
30
29
} ,
@@ -74,8 +73,6 @@ router.get("/", function (req, res) {
74
73
} ) ;
75
74
76
75
router . get ( "/:pos" , function ( req , res ) {
77
-
78
- const partOfSpeech = req . params . pos ;
79
76
res . header ( "Access-Control-Allow-Origin" , "*" ) ;
80
77
res . header (
81
78
"Access-Control-Allow-Headers" ,
@@ -88,9 +85,11 @@ router.get("/:pos", function (req, res) {
88
85
res . header ( "Strict-Transport-Security" , "max-age=63072000" ) ;
89
86
res . setHeader ( "Content-Type" , "application/json" ) ;
90
87
88
+ const partOfSpeech = req . params . pos ;
89
+
91
90
axios ( {
92
91
method : "GET" ,
93
- url : `https://randomword.com /${ partOfSpeech } ` ,
92
+ url : `${ baseUrl } /${ partOfSpeech } ` ,
94
93
headers : {
95
94
"User-Agent" : rua ,
96
95
} ,
0 commit comments