Natsuki's API!
https://api.natsuki.app
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
710 B
20 lines
710 B
const fs = require('fs');
|
|
const {Router} = require("express");
|
|
const chalk = require("chalk");
|
|
|
|
const reqTypeColors = require('../../util/misc/rtcolors');
|
|
|
|
const router = Router();
|
|
|
|
module.exports = app => {
|
|
router
|
|
.use((req, res, next) => {console.log(`${chalk.gray(`[ANI/v1]`)} ${req.path} ${chalk.gray(`|`)} [${chalk[reqTypeColors[req.method]](req.method)}]`); next()})
|
|
.get('/', (req, res) => res.send("This is the Natsuki Anime DB API v1 head."))
|
|
|
|
fs.readdirSync('./ani/v1/routes').filter(file => file.endsWith('.js'))
|
|
.forEach(route => require(`./routes/${route}`)(app, router)); //execute all router functions
|
|
|
|
router.location = '/ani/v1';
|
|
|
|
return router;
|
|
}; |