https://github.com/allsamir/restful-api
This is the API repository where A given latitude and longitude as query parameters and returns the users close around 10 km of the given latitude and longitude value.
https://github.com/allsamir/restful-api
Last synced: 10 months ago
JSON representation
This is the API repository where A given latitude and longitude as query parameters and returns the users close around 10 km of the given latitude and longitude value.
- Host: GitHub
- URL: https://github.com/allsamir/restful-api
- Owner: Allsamir
- Created: 2024-08-02T08:14:47.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-02T09:04:32.000Z (almost 2 years ago)
- Last Synced: 2025-03-24T16:14:24.410Z (about 1 year ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node.js REST API with MongoDB for Geospatial Queries
This Node.js application provides a REST API that accepts latitude and longitude as input parameters and returns a sorted list of users within a 10-kilometer radius. It includes pagination and error handling for invalid or missing parameters.
## Features
- Store user data with latitude and longitude in MongoDB.
- Query users within a 10-kilometer radius of provided coordinates.
- Calculate distances using the Haversine formula.
- Sort users by distance in ascending order.
- Support pagination to limit results.
- Error handling for missing or invalid input parameters.
## Prerequisites
- Node.js (v14 or later)
- MongoDB (Atlas or local instance)
## Getting Started
### Clone the Repository
```bash
git clone https://github.com/Allsamir/Blogging.git
cd Blogging
```
### Install Dependencies
``` bash
npm install
```
### Run the Application
``` bash
npm start
```