From 749dd0dbb2dd1b21658b845564000fb995a070fa Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 27 Jan 2026 17:24:34 +0100 Subject: [PATCH] chore: basic project goal --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b13ca39..bd1f7bd 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,53 @@ -# Musicparty management repository template +# Apidoc -This is a template repository, use it to create other repositories. +A code utility to manage your API:s, purely derrived from code (doc-comments). + +## Trivial example + +````ts +// @apidoc TYPE User.Token +// [readonly] [auth] +// +// A JWT token used to verify identity at secured endpoints. +// +// ## Schema +// string.jwt +// +// ## Examples +// +// ``` +// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.KMUFsIDTnFmyG3nMiGM6H9FNFUROf3wh7SmqJp-QV30 +// ``` +type Token = string; + +// @apidoc POST /auth/register Sign-in as user `User.login` +// +// Using credentials and details, request that a `User` be created and stored, +// returning a `User.token`. +// +// ## Body JSON +// username: string.ascii(max: 32) [unique] [example = `tommylive`] +// email: string.email The email to use when authenticating the user. +// password: string(min: 8) [sendonly] +// A plain-text password to hash and store for authentication. +// +// Password criteria: +// - >8 characters +// - >1 uppercase ascii letter +// - >1 symbol, defined as any non-ascii-alphanumeric character +// display_name?: string(max: 32) [example = `Tommy`] +// An alternative name to show instead of the username +// +// ## Responses +// ### 200 User created JSON +// +// The user passed checks and was created. +// +// token: User.Token Token to identify as the newly created user +// +// ### 400 Invalid payload +// ### 409 Username taken +export async function processRegister(req: Request, res: Response) { + // ... +} +```` -- 2.49.1