diff --git a/src/api/index.js b/src/api/index.js index 53ee720..0eb51f0 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,7 +1,13 @@ const express = require('express'); -const api = express(); -api.get('/', (req, res) => res.send("You've reached the wubzy.xyz API. If you're looking for Natsuki's endpoints, please append /natsuki to your query.")); -api.get('/natsuki', (req, res) => res.send("You've reached Natsuki's API. Receiving this 200 reply indicates that Natsuki is online.")); +module.exports = (client) => { + const api = express(); + client.api = {wubzy: {}, natsuki: {}}; + client.api.wubzy.app = api; -const server = api.listen(4072, () => console.log(`Ready at ${server.address().address}:${server.address().port}`)); \ No newline at end of file + client.api.wubzy.app.get('/', (req, res) => res.send("You've reached the wubzy.xyz API. If you're looking for Natsuki's endpoints, please append /natsuki to your query.")); + client.api.wubzy.app.get('/natsuki', (req, res) => res.send("You've reached Natsuki's status endpoint. Receiving this 200 reply indicates that Natsuki is online. If you're looking for the Natsuki API, it has been moved to natsuki.app")); + client.api.wubzy.app.get('/natsuki/:any?', (req, res) => res.status(301).send("Natsuki's API permanently resides at natsuki.app")); + + client.api.wubzy.server = client.api.wubzy.app.listen(4072, () => console.log(`Ready at ${client.api.wubzy.server.address().address}:${client.api.wubzy.server.address().port}`)); +}; \ No newline at end of file diff --git a/src/handle/runtime/events/ready.js b/src/handle/runtime/events/ready.js index e07fc04..a7898a5 100644 --- a/src/handle/runtime/events/ready.js +++ b/src/handle/runtime/events/ready.js @@ -3,4 +3,6 @@ module.exports = async client => { require('../../startup/run/hello')(client); // startup info require('../../startup/run/setstatus')(client); + + require('../../../api/index')(client); }; \ No newline at end of file