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.
21 lines
520 B
JavaScript
21 lines
520 B
JavaScript
const z = require("zod")
|
|
|
|
const nameSchema = z.string()
|
|
.min(1)
|
|
.max(16)
|
|
.regex(/^[a-zA-Z0-9_]+$/, { message: "Name can only contain alphanumeric characters and underscores." });
|
|
|
|
module.exports = {
|
|
GET: {
|
|
headers: z.object({
|
|
"authorization": z.string().min(1, { message: "Authorization header is required." })
|
|
}),
|
|
params: z.object({
|
|
name: nameSchema
|
|
}),
|
|
error: {
|
|
code: 401,
|
|
message: "Unauthorized"
|
|
}
|
|
}
|
|
} |