Add base project files including environment example, license, README, .gitignore, error classes, ESLint config, database modules, texture assets, repositories, routes, schemas, services, and server entry point. This establishes the foundational structure for a Yggdrasil-compatible REST API with modular error handling, database setup, and route organization.
17 lines
576 B
JavaScript
17 lines
576 B
JavaScript
const express = require("express")
|
|
const router = express.Router()
|
|
const utils = require("../modules/utils")
|
|
const serverService = require("../services/serverService")
|
|
|
|
if (utils.isTrueFromDotEnv("SUPPORT_AUTHLIB_INJECTOR")) {
|
|
router.get("/", (req, res) => {
|
|
const hostname = req.hostname
|
|
const metadata = serverService.getServerMetadata(hostname)
|
|
res.header("X-Authlib-Injector-Date", new Date().toISOString())
|
|
return res.status(200).json(metadata)
|
|
})
|
|
} else {
|
|
router.get("/", (req, res, next) => next())
|
|
}
|
|
|
|
module.exports = router |