This is a work in progress and may not function fully yet.
This repository contains a Node.js application for uploading images and performing video streaming. This guide will help you set up the project locally on your machine.
Before you begin, ensure you have met the following requirements:
- Node.js (including npm)
- Docker Desktop
- Git
First, clone the repository to your local machine using Git.
git clone https://github.com/your-username/your-repo.git cd your-repo
If you haven't installed Node.js and npm, download and install them from here. Verify the installation by running:
node --version npm --version
Navigate to the project directory and install the required Node.js packages:
cd path/to/your/project npm install
Run MongoDB using Docker. Ensure Docker Desktop is installed and running, then execute the following command to start a MongoDB container:
docker run -d -p 27017:27017 --name mongodb mongo:latest Verify the MongoDB container is running:
docker ps
Ensure the uploads directory exists in your project root. Create it if it does not exist:
mkdir uploads
If your application requires environment variables, create a .env file in the project root and add your variables. Example:
MONGODB_URI=mongodb://localhost:27017/imageDB PORT=3000
Run the Node.js application:
node server.js The server should now be running at http://localhost:3000.
You can use tools like Postman or curl to test the endpoints.
Using curl:
curl -X POST http://localhost:3000/upload-image -H "Content-Type: multipart/form-data" -F "image=@path/to/your/image.jpg" -F "event=Sample Event" Using Postman:
Set the URL to http://localhost:3000/upload-image. In the Body section, choose form-data and add the fields: Key: image, Type: File, Value: (select an image file) Key: event, Type: Text, Value: Sample Event Click Send. Clear Data Using curl:
curl -X POST http://localhost:3000/clear-data Using Postman:
Create a new POST request. Set the URL to http://localhost:3000/clear-data. Click Send.
If you want to contribute to this project, follow these steps:
Fork the repository. Create a new branch (git checkout -b feature-branch). Make your changes and commit them (git commit -m 'Add new feature'). Push to the branch (git push origin feature-branch). Create a new Pull Request. License This project is licensed under the MIT License - see the LICENSE file for details.