I've integrated APIs for my bot, expecting them to work smoothly. However, I'm still struggling to figure out why the server keeps aborting itself... Here is the error output, code, and a screenshot. Any help would be greatly appreciated.
Error: Request aborted
at onaborted (/home/runner/TModeration-Server/node_modules/express/lib/response.js:1052:15)
at Immediate._onImmediate (/home/runner/TModeration-Server/node_modules/express/lib/response.js:1094:9) {
code: 'ECONNABORTED'
}
// API server
const express = require('express')
const path = require("path")
const app = express()
const PORT = 443
app.get('/api/', (req, res) => {
var options = {
root: path.join(__dirname)
};
res.writeHead(200, {'Content-Type': 'text/plain'})
const requiredFile = req.path.toLowerCase.replaceAll('https://', '').replaceAll('tmoderation-server.henry133.repl.co', '').replaceAll('/api/', '')
res.sendFile(`./APIs/${requiredFile ?? "index.js&`()`, options, function(err) { console.log(err) })
res.end()
})
app.get('/', (req, res) => {
var options = {
root: path.join(__dirname)
};
res.writeHead(200, {'Content-Type': 'text/html'})
res.sendFile("./html.txt&`()`, options, function(err) { console.log(err) })
res.end()
})
app.listen(PORT || 443, () => {
console.log(`APIs [BETA] is listening ${PORT}`)
})