feat: add link creation and lookup
finally has the bare minimum functionality to say that it works!
This commit is contained in:
@@ -2,6 +2,7 @@ import { Router } from 'express';
|
||||
import validateSchema from '../tools/validateSchema';
|
||||
import * as lc from '../controllers/linkController';
|
||||
import * as ls from '../schemas/linkSchema';
|
||||
import requireUser from '../middleware/requireUser';
|
||||
|
||||
const linkRouter = Router();
|
||||
|
||||
@@ -96,5 +97,42 @@ linkRouter.get('/api/v1/link/short', validateSchema(ls.shortLinkRequestSchema),
|
||||
*/
|
||||
linkRouter.get('/api/v1/link/fromWordlist', validateSchema(ls.sentenceLinkRequestSchema), lc.generateSentenceLinkHandler);
|
||||
|
||||
/**
|
||||
* @openapi
|
||||
*
|
||||
* /api/v1/link/new:
|
||||
* post:
|
||||
* description:
|
||||
* Register a new shortened URL. <br/>
|
||||
* See linkSchema.ts for constraints.
|
||||
* tags: [Link]
|
||||
* summary: Shorten a link
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/CreateLinkRequestDTO'
|
||||
* produces:
|
||||
* - application/json
|
||||
* responses:
|
||||
* 200:
|
||||
* description: New link created successfully
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/CreateLinkResponseDTO'
|
||||
* 400:
|
||||
* description: Bad request
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/ErrorDTO'
|
||||
*/
|
||||
linkRouter.post('/api/v1/link/new',
|
||||
validateSchema(ls.createLinkRequestSchema),
|
||||
lc.createLinkHandler
|
||||
);
|
||||
|
||||
|
||||
export default linkRouter;
|
||||
Reference in New Issue
Block a user