mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 10:55:10 +00:00
feat: add complete API endpoints for full website
- Add /api/watch endpoint for watch page data - Add /api/az-list for alphabetical browsing - Add /api/new-release and /api/newly-added - Add /api/status for ongoing/completed lists - Add /api/trending-sidebar for sidebar data - Update README with all new endpoints - Update CHANGELOG
This commit is contained in:
@@ -11,6 +11,11 @@ import { getSuggestions } from "../controllers/suggestion.controller.js";
|
||||
import { getRandom } from "../controllers/random.controller.js";
|
||||
import { getPopular } from "../controllers/popular.controller.js";
|
||||
import { getFilter } from "../controllers/filter.controller.js";
|
||||
import { getWatchPage } from "../controllers/watchPage.controller.js";
|
||||
import { getAzList } from "../controllers/azList.controller.js";
|
||||
import { getNewRelease, getNewlyAdded } from "../controllers/newRelease.controller.js";
|
||||
import { getStatus } from "../controllers/status.controller.js";
|
||||
import { getTrendingSidebar } from "../controllers/trendingSidebar.controller.js";
|
||||
import { categoryRoutes } from "./category.route.js";
|
||||
|
||||
const createApiRoutes = (app, jsonResponse, jsonError) => {
|
||||
@@ -30,6 +35,14 @@ const createApiRoutes = (app, jsonResponse, jsonError) => {
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/api/watch", async (req, res, next) => {
|
||||
try {
|
||||
await getWatchPage(req, res, next);
|
||||
} catch (error) {
|
||||
jsonError(res, error.message);
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/api/search", async (req, res, next) => {
|
||||
try {
|
||||
await getSearchResults(req, res, next);
|
||||
@@ -126,6 +139,46 @@ const createApiRoutes = (app, jsonResponse, jsonError) => {
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/api/new-release", async (req, res, next) => {
|
||||
try {
|
||||
await getNewRelease(req, res, next);
|
||||
} catch (error) {
|
||||
jsonError(res, error.message);
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/api/newly-added", async (req, res, next) => {
|
||||
try {
|
||||
await getNewlyAdded(req, res, next);
|
||||
} catch (error) {
|
||||
jsonError(res, error.message);
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/api/trending-sidebar", async (req, res, next) => {
|
||||
try {
|
||||
await getTrendingSidebar(req, res, next);
|
||||
} catch (error) {
|
||||
jsonError(res, error.message);
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/api/az-list/:letter", async (req, res, next) => {
|
||||
try {
|
||||
await getAzList(req, res, next);
|
||||
} catch (error) {
|
||||
jsonError(res, error.message);
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/api/status/:status", async (req, res, next) => {
|
||||
try {
|
||||
await getStatus(req, res, next);
|
||||
} catch (error) {
|
||||
jsonError(res, error.message);
|
||||
}
|
||||
});
|
||||
|
||||
categoryRoutes(app, jsonResponse, jsonError);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user