File Management
This documentation covers all endpoints related to file management functions.
Endpoints
Get File
- Method: GET
- URL:
http://localhost:3000/file/your_id - Body: Form data
file: file (e.g.,/path/to/your/file.jpg)
Post File
- Method: POST
- URL:
http://localhost:3000/file - Body: Form data
file: file (e.g.,/path/to/your/file.jpg)
Update File
- Method: PUT
- URL:
http://localhost:3000/file/your_id - Body: Form data
file: file (e.g.,/path/to/your/file.jpg)
Delete File
- Method: DELETE
- URL:
http://localhost:3000/file/your_id
Get All Files
- Method: GET
- URL:
http://localhost:3000/files
Custom Endpoints
It's important to note that this is a barebones not specific auth backend, you can customize it all you want easily!
You can add a new endpoint in the fileRoutes.ts file as following:
fileRoutes.ts
router.post("/custom_endpoint", upload.single(uploadName) , handleSomthing)You can customize your handleSomthing function inside of the fileConroller.ts file as the following:
fileConroller.ts
export async function handleSomthing(req: Request, res: Response) {
const { file } = req;
if (!file) {
return res.status(500).send("Error uploading file");
}
//Logic here...
}