82 lines
No EOL
1.5 KiB
Markdown
82 lines
No EOL
1.5 KiB
Markdown
# Dario API
|
|
|
|
The Dario API is a RESTful API built using Express.js, MongoDB, and Redis, designed to provide endpoints for user eligibility verification and registration.
|
|
|
|
## Table of Contents
|
|
|
|
- [Getting Started](#getting-started)
|
|
- [Prerequisites](#prerequisites)
|
|
- [Installation](#installation)
|
|
- [Configuration](#configuration)
|
|
- [Usage](#usage)
|
|
- [Starting the Server](#starting-the-server)
|
|
- [Endpoints](#endpoints)
|
|
- [Contributing](#contributing)
|
|
- [License](#license)
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
Before running the Dario API, ensure you have the following installed on your system:
|
|
|
|
- Node.js (v14 or higher)
|
|
- MongoDB
|
|
- Redis Server
|
|
|
|
### Installation
|
|
|
|
1. Clone this repository to your local machine:
|
|
|
|
```sh
|
|
git clone https://github.com/yourusername/dario-api.git
|
|
|
|
```
|
|
|
|
2. Install the required npm packages:
|
|
|
|
```sh
|
|
cd api
|
|
npm install
|
|
```
|
|
|
|
### Configuration
|
|
Create a .env file in the root directory of the project with the variables listed in .env.example.
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
npm run dev
|
|
```
|
|
|
|
### Endpoints
|
|
|
|
# POST /verify-eligibility
|
|
|
|
Verify user eligibility based on a provided key.
|
|
Example Request:
|
|
|
|
```sh
|
|
POST http://localhost:3000/verify-eligibility
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"key": "your_user_key"
|
|
}
|
|
```
|
|
|
|
# POST /register
|
|
Register a user after verifying eligibility.
|
|
Example Request:
|
|
```sh
|
|
POST http://localhost:3000/register
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"email": "johndoe@example.com",
|
|
"key": "your_user_key",
|
|
"name": "John Doe",
|
|
"phone": "123-456-7890"
|
|
}
|
|
``` |