Get Up and Running
This guide will have you uploading files through API Master in less than 5 minutes.Clone or Download the Project
Get the source code on your local machine:
The project contains all necessary TypeScript configuration and dependencies defined in
package.json.Install Dependencies
Install all required packages using npm:This will install:
express- Web frameworkcors- CORS middlewaremulter- File upload handling- TypeScript and all type definitions
Build the Project
Compile TypeScript to JavaScript:This creates the
dist/ directory with compiled JavaScript files.Start the Server
Launch the API server:You should see:
By default, the server runs on port 3000. You can change this by setting the
PORT environment variable.Verify Everything Works
Test the welcome endpoint to confirm the API is running:Understanding the Upload Flow
Here’s how API Master handles file uploads under the hood:How it works:
- Multer intercepts the multipart/form-data request
- Files are stored in the
uploads/directory with unique names - The controller generates a public URL pointing to the uploaded file
- Express serves uploaded files via the
/uploadsstatic route
Test with Other Tools
CORS is Pre-Configured
API Master comes with CORS enabled for all origins in development:app.ts
Common Issues
Port 3000 is already in use
Port 3000 is already in use
Set a different port:
uploads/ directory not found
uploads/ directory not found
Create the uploads directory manually:
No file uploaded error
No file uploaded error
Ensure your form field name is
file or the request includes -F "file=@..." in curl.Next Steps
Now that you have API Master running:API Reference
Explore all available endpoints and parameters
Configuration
Customize CORS, file storage, and server settings
Deployment
Deploy to production environments
Error Handling
Handle errors and edge cases effectively