Hey,
I’ve incorporated Express Routing in my Glitch project (Yep im making an API service) and for a strange reason, only some of my router files custom.js, effects.js, generators.js, gif.js are working in the same directory (/Routes) while my other 2 (overlays.js and text.js) are not working. They pretty much use the same code (which i will show).
Working Router (generators.js)
const express = require('express');
const router = express.Router();
const { get } = require('node-superfetch');
router.get('/', function(req, res) {
res.redirect('/docs');
});
const rateLimit = require("../utils/ratelimits")
//router.use(rateLimit.test);
router.use('/3000years', require('../Canvas/generators/3000years'));
module.exports = router;
Broken (text.js)
const express = require('express');
const router = express.Router();
const { get } = require('node-superfetch');
router.get('/', function(req, res) {
res.redirect('/docs');
});
const rateLimit = require("../utils/ratelimits")
//router.use(rateLimit.test);
let hangmanword = require('../JSON/text/hangman');
router.get('/hangmanrandoms', function (req, res) {
let hangmanwordrandom = hangmanword[Math.floor(Math.random() * hangmanword.length)]
res.send(({word: hangmanwordrandom}))
});
module.exports = router;
Yes, they look very identical but why is this happening? I renamed the files and same thing happen. Routing is working perfectly for 4 of my files but not the other two.
Project: ichigo-api-rewrite