From 8b698357fa75857293fad16e42ef615f610d44fc Mon Sep 17 00:00:00 2001 From: Darkangeel_hd Date: Wed, 22 Jun 2022 03:09:28 +0200 Subject: [PATCH 1/2] Fixed typo in '/latest' endpoint It also maintains compatibility with old call --- docs/Endpoints.md | 2 +- src/controllers/index.ts | 2 +- src/controllers/{lastest.ts => latest.ts} | 2 +- src/router.ts | 6 +++--- src/types.d.ts | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) rename src/controllers/{lastest.ts => latest.ts} (92%) diff --git a/docs/Endpoints.md b/docs/Endpoints.md index 3fcc796..caa5998 100644 --- a/docs/Endpoints.md +++ b/docs/Endpoints.md @@ -1,6 +1,6 @@ ## Endpoints -> PATH: /lastest +> PATH: /latest |Querys|Params| |-|-| diff --git a/src/controllers/index.ts b/src/controllers/index.ts index 3d912f2..085ebbb 100644 --- a/src/controllers/index.ts +++ b/src/controllers/index.ts @@ -1,6 +1,6 @@ export * from './all' export * from './anime' -export * from './lastest' +export * from './latest' export * from './calendar' export * from './emision' export * from './search' diff --git a/src/controllers/lastest.ts b/src/controllers/latest.ts similarity index 92% rename from src/controllers/lastest.ts rename to src/controllers/latest.ts index 5684d7f..11f36f3 100644 --- a/src/controllers/lastest.ts +++ b/src/controllers/latest.ts @@ -1,7 +1,7 @@ import { Controller } from '../types' import { get, parse, attr, url } from '../api' -export const getLastest: Controller = async (req, res) => { +export const getLatest: Controller = async (req, res) => { try { const { data } = await get(url) const html = parse(data) diff --git a/src/router.ts b/src/router.ts index fdedb9e..dfe3459 100644 --- a/src/router.ts +++ b/src/router.ts @@ -1,7 +1,7 @@ import { Router } from 'express' import { getAll, - getLastest, + getLatest, getCalendar, getEmision, getAnime, @@ -18,7 +18,7 @@ routes.get('/', (_, res) => { author: 'Carlos Burelo', repository: 'https://github.com/carlos-burelo/monoschinos-api-v2', endpoints: { - lastest: '/lastest', + latest: '/latest', emision: '/emision', calendar: '/week', getAnimeByID: '/anime/:id', @@ -34,7 +34,7 @@ routes.get('/', (_, res) => { }) routes.get('/all', getAll) -routes.get('/lastest', getLastest) +routes.get(['/lastest', '/latest'], getLatest) routes.get('/week', getCalendar) routes.get('/emision', getEmision) routes.get('/anime/:id', getAnime) diff --git a/src/types.d.ts b/src/types.d.ts index 7b2ba8b..13d65cd 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -2,7 +2,7 @@ import { Request, Response } from 'express' export type Controller = (req: Request, res: Response) => void -export interface Lastest { +export interface Latest { id: string title: string image: string From 3582eb65c90bad59614055c521964b94e107161f Mon Sep 17 00:00:00 2001 From: Darkangeel_hd Date: Wed, 22 Jun 2022 03:40:51 +0200 Subject: [PATCH 2/2] Remaned endpoint to by consistent with namescheme getAnimesByPage --> getAnimeByPage also fixed another typo --- src/router.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/router.ts b/src/router.ts index dfe3459..164a2e3 100644 --- a/src/router.ts +++ b/src/router.ts @@ -22,12 +22,12 @@ routes.get('/', (_, res) => { emision: '/emision', calendar: '/week', getAnimeByID: '/anime/:id', - getAnimesByPage: '/all', + getAnimeByPage: '/all', getEpisodeByID: '/ver/:id', searchAnimeByID: '/search/:id', filterBy: { path: '/filterBy', - querys: ['categoria', 'fecha', 'genero', 'letra', 'pagina'], + query: ['categoria', 'fecha', 'genero', 'letra', 'pagina'], }, }, })