This repository contains a sample Express Node.js API with MongoDB integration, along with a Docker Compose file to facilitate easy local deployment using Docker and Node.js.
Before running the application, ensure that you have the following dependencies installed on your system:
- Node.js (v14 or higher)
- Docker
- Docker Compose
To get started with this API locally, follow the steps below:
-
Clone this repository to your local machine:
git clone https://github.com/erfanrmz/backend-api.git
-
Navigate to the project's root directory:
cd backend-api-master
-
Start the application using Docker Compose:
docker-compose up
This command will build the Docker images and start the containers for the API and MongoDB.
4.Once the containers are up and running, you can access the API at http://localhost:5000.
The API supports the following endpoints:
POST /create-partner
: creating a partner and save it in databaseGET /load-partner:id
: Retrieves a partner by its ID.@route GET /search-partner:long&lat
: searching a point and find nearest partner with lang and lat in query
You can use tools like Postman or curl to interact with the API.
- first install mocha with npm
npm install -g mocha
2.install all dependecies
npm install
- run ATDD.js with mocha
mocha ATDD.js
- if running scripts is disable on your system open a powershell and set Execution Policy to RemoteSigned
Set-ExecutionPolicy RemoteSigned
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request to this repository.
This project is licensed under the MIT License.