This is the frontend for the Gehe.fyi project, a URL shortener bootstrapped with create-next-app.
To start the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devVisit http://localhost:3000 in your browser to see the application in action.
Edit the page by modifying app/page.js. The page updates automatically as you make changes.
This project utilizes next/font for automatic optimization and loading of the Inter font from Google Fonts.
This section is for frontend developers who need to interact with the backend APIs.
All API requests should be sent to:
https://api.yourapp.com/v1
All endpoints, except for login and registration, require authentication using a JSON Web Token (JWT). Include the token in the Authorization header:
Authorization: Bearer YOUR_JWT_TOKEN-
Login
-
Endpoint: POST /auth/login
-
Body:
{ "email": "user@example.com", "password": "your_password" } -
Response:
{ "token": "jwt_token", "user": { "id": "user_id", "name": "John Doe", "email": "user@example.com" } }
-
-
Register
-
Endpoint: POST /auth/register
-
Body:
{ "name": "John Doe", "email": "user@example.com", "password": "your_password" } -
Response:
{ "message": "User registered successfully", "user": { "id": "user_id", "name": "John Doe", "email": "user@example.com" } }
-
-
Get User Profile
-
Endpoint: GET /users/me
-
Headers:
Authorization: Bearer YOUR_JWT_TOKEN -
Response:
{ "id": "user_id", "name": "John Doe", "email": "user@example.com", "createdAt": "2023-01-01T00:00:00Z" }
-
-
Update User Profile
-
Endpoint: PUT /users/me
-
Headers:
Authorization: Bearer YOUR_JWT_TOKEN -
Body:
{ "name": "Jane Doe", "password": "new_password" } -
Response:
{ "message": "Profile updated successfully", "user": { "id": "user_id", "name": "Jane Doe", "email": "user@example.com" } }
-
-
Get Items
-
Endpoint: GET /items
-
Headers:
Authorization: Bearer YOUR_JWT_TOKEN -
Query Parameters: Page (integer, optional), Limit (integer, optional)
-
Response:
{ "items": [ { "id": "item_id", "name": "Item Name", "description": "Item Description", "createdAt": "2023-01-01T00:00:00Z" } ], "pagination": { "page": 1, "limit": 10, "totalPages": 5, "totalItems": 50 } }
-
-
Create Item
-
Endpoint: POST /items
-
Headers:
Authorization: Bearer YOUR_JWT_TOKEN -
Body:
{ "name": "New Item", "description": "Description of the new item" } -
Response:
{ "message": "Item created successfully", "item": { "id": "item_id", "name": "New Item", "description": "Description of the new item", "createdAt": "2023-01-01T00:00:00Z" } }
-
Errors are returned with appropriate HTTP status codes and a JSON body:
{
"error": {
"status": 400,
"message": "Detailed error message"
}
}For any questions or issues, contact the backend team:
- Email: backend-team@yourapp.com
- Slack: #backend-support