This commit is contained in:
bingus_violet 2024-06-19 12:55:18 -05:00
parent 68ee9be768
commit 84f53c40b8
2 changed files with 20 additions and 0 deletions

1
.gitignore vendored
View file

@ -130,3 +130,4 @@ dist
.yarn/install-state.gz
.pnp.*
config

View file

@ -15,6 +15,21 @@ var pfpSeason = "default"
var violetSpins = 0
var configPath = path.join(__dirname, "config")
if (!fs.existsSync(configPath)) {
fs.mkdirSync(configPath)
}
var configs = ["socials.json"]
for (var i = 0; i < configs.length; i++) {
var file = configs[i]
var filePath = path.join(configPath, file)
if (!fs.existsSync(filePath)) {
fs.writeFileSync(filePath, "{}")
}
}
function randomFileInDir(directory) {
var dir = fs.readdirSync(directory)
return path.join(directory, dir[Math.floor(Math.random() * dir.length)])
@ -56,6 +71,10 @@ app.get("/v1/spins", (req, res) => {
res.send(violetSpins.toString())
})
app.get("/v1/socials", (req, res) => {
res.sendFile(path.join(configPath, "socials.json"))
})
// app.listen(PORT, () => {
// console.log("API is now listening on port 8080!")
// })