Welcome to the documentation for the Node.js application that powers the website running on localhost:3000
. This application provides functionality for file uploads through a REST API and retrieves file metadata. This guide will walk you through setup, usage, and API endpoints.
- Node.js installed on your machine.
-
Clone the Repository from GitHub:
git clone https://github.com/abhiseksr/fileinfo
-
Navigate to the Project Directory:
cd fileinfo
-
Install Dependencies:
npm install
-
Start the Node.js Server: npm start
-
Access the Website: Open your web browser and navigate to http://localhost:3000.
Upload files to the server using the following API endpoint:
- Endpoint:
POST /
- Parameters:
file
: The file to be uploaded.
- Response:
- Successful upload (Browser): Returns an HTML response.
- Successful upload (Postman): Returns a JSON object with the uploaded file details.
- Error: Returns an error message.
Retrieve file metadata using the following API endpoint:
- Endpoint:
GET /
- Parameters:
filename
: The name of the uploaded file.
- Response:
- Successful request: Returns a JSON object containing file metadata.
- Error: Returns an error message.
Visit http://localhost:3000 in your web browser to upload a file. You'll receive an HTML response.
Send a POST request to http://localhost:3000/
with the file
parameter. Set the Accept
header to application/json
to receive a JSON response.