fix: API not working on Windows

This commit is contained in:
Isaac 2022-08-25 23:35:17 +01:00
parent 9936b05fbb
commit f74069deb6
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33

View File

@ -135,6 +135,7 @@ module.exports = client => {
const path = file
.substring(0, file.length - 3) // remove `.js`
.substring(dir.length) // remove higher directories
.replace(/\\/g, '/') // replace `\` with `/` because Windows is stupid
.replace(/\[(\w+)\]/gi, ':$1') // convert [] to :
.replace('/index', '') || '/'; // remove index
const route = require(file);