0% found this document useful (0 votes)
129 views6 pages

Scribd API Documentation Overview

This API documentation outlines the endpoints for creating, updating, and managing problems using Express, TypeScript, and Prisma, with authentication via Passport.js. Key functionalities include creating a problem, updating it, attaching files, adding tags, and retrieving problem details, each with specified request bodies and response formats. The server is configured to run on port 3000 with CORS enabled for localhost, and includes middleware for session management and JSON parsing.

Uploaded by

ma.lachi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
129 views6 pages

Scribd API Documentation Overview

This API documentation outlines the endpoints for creating, updating, and managing problems using Express, TypeScript, and Prisma, with authentication via Passport.js. Key functionalities include creating a problem, updating it, attaching files, adding tags, and retrieving problem details, each with specified request bodies and response formats. The server is configured to run on port 3000 with CORS enabled for localhost, and includes middleware for session management and JSON parsing.

Uploaded by

ma.lachi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

API Documentation

Overview

This API is built using Express, TypeScript, Prisma, and includes authentication with [Link].

Server Configuration

Port: Configured via environment variable, defaults to 3000

CORS: Configured for [Link]

Middleware:

- JSON parsing

- URL-encoded body parsing

- Session management

- Passport authentication

Create a Problem

Endpoint: POST /problem/create

Request Body:

"title": string,

"description": string,

"category": string,

"budget": number,

"status": string,

"userID": number

}
Responses:

201: Problem created successfully

"message": "Problem created successfully",

"problem": {

"problemID": number,

"title": string,

"description": string,

"category": string,

"budget": number,

"status": string,

"userID": number

400: Missing required fields

500: Server error when creating problem

Update a Problem

Endpoint: PUT /problem/update/:problemID

Request Parameters:

problemID: Numeric ID of the problem

Request Body:

"title"?: string,
"description"?: string,

"category"?: string,

"budget"?: number,

"status"?: string

Responses:

200: Problem updated successfully

"message": "Problem updated successfully",

"problem": {

"problemID": number,

"title": string,

"description": string,

"category": string,

"budget": number,

"status": string

500: Server error when updating problem

Attach File to Problem

Endpoint: POST /problem/attach-file/:problemID

Request Parameters:

problemID: Numeric ID of the problem


Request Body:

Multipart form-data with file upload

Responses:

200: File attached successfully

"message": "File attached successfully",

"problem": {

"attachments": string (file path)

400: No file uploaded

500: Error attaching file

Add Tags to Problem

Endpoint: POST /problem/add-tags/:problemID

Request Parameters:

problemID: Numeric ID of the problem

Request Body:

"tags": string[]

Responses:

200: Tags added successfully


{

"message": "Tags added successfully",

"problem": {

"category": string (comma-separated tags)

400: Invalid tags format

500: Error adding tags

Get Problem Details

Endpoint: GET /problem/:problemID

Request Parameters:

problemID: Numeric ID of the problem

Responses:

200: Problem details retrieved

"problemID": number,

"title": string,

"description": string,

"category": string,

"budget": number,

"status": string,

"userID": number,

"attachments"?: string
}

404: Problem not found

500: Error retrieving problem

You might also like