This is a Next.js space bootstrapped with create-next-app
.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx
. The page auto-updates as you edit the file.
This space uses next/font
to automatically optimize and load Inter, a custom Google Font.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.
- This document provides an overview of the public API route implemented in the route.ts file, detailing its functionality, required headers, and how to use it effectively. This API route is designed to fetch articles based on specific criteria provided through request headers
- The GET API route allows users to retrieve articles from the database. Users can specify whether they want to fetch all articles, only private articles, or only public articles associated with a specific space and user ID. The route performs several checks to ensure the request is authorized and the requested data exists.
To use this API route, the following headers must be included in the request:
- next_notpadd_userId: The user ID for whom the articles are being fetched.
- next_notpadd_spaceId: The space ID from which the articles are being fetched.
- get_only_private_articles: Set to "True" if only private articles should be fetched. Cannot be "True" if get_only_public_articles is also "True".
- get_only_public_articles: Set to "True" if only public articles should be fetched. Cannot be "True" if get_only_private_articles is also "True".
- get_all_articles: Set to "True" if all articles (regardless of their visibility status) should be fetched.
GET /api/public Headers: next_notpadd_userId: next_notpadd_spaceId: get_all_articles: True Response: contain all the articles if you have any articles created. Error: With the status codes for guidelines
- 200 OK: The request was successful. The body of the response contains the requested articles.
- 400 Bad Request: Both get_only_private_articles and get_only_public_articles were set to "True", which is not allowed.
- 401 Unauthorized: The user ID or space ID is missing, invalid, or the user does not have permission to access the requested data.
- 404 Not Found: No articles were found matching the criteria.
- 500 Internal Server Error: An unexpected error occurred on the server.