Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amolthakare/marketing-app
marketing app
https://github.com/amolthakare/marketing-app
expressjs javascript mongodb-atlas mongoosejs
Last synced: 9 days ago
JSON representation
marketing app
- Host: GitHub
- URL: https://github.com/amolthakare/marketing-app
- Owner: amolthakare
- Created: 2024-05-09T04:36:20.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-13T07:02:17.000Z (6 months ago)
- Last Synced: 2024-10-18T14:38:39.837Z (about 1 month ago)
- Topics: expressjs, javascript, mongodb-atlas, mongoosejs
- Language: JavaScript
- Homepage: https://marketing-app-nvpy.onrender.com
- Size: 3.02 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
deployment Link : https://multi-level-marketing.onrender.com
# Multi-Level Marketing API
This is a Multi-Level Marketing (MLM) API developed using Node.js and MongoDB. It allows users to create a multi-level network and distribute earnings among different levels of users based on specified rules.
## Installation
1. Clone the repository:
```bash
git clone https://github.com/amolthakare/marketing-app.git
```## Create a .env file in the root directory and add the following environment variables:
```bash
mongoURL=`your mongodb url`
port = `port`
key =`your key`
```## Install dependencies and start server
```bash
cd marketing-app
npm install
node index.js
```## API Endpoints
### Schema
| parameter | type | description |
| :---- | :---- | :---- |
| `name` | `String` | Required: user name |
| `parentId` | `ObjectId` | required: ref of `User` |
| `level` | `Number` | Required: level will be set as parentLevel+1 and if no parent then 0 |
| `earnings` | `Number` | Earning of the user |### Create a new user
- URL: https://multi-level-marketing.onrender.com/users
- Method: POST
- Request Body:
```bash
{
"name": "",
"parentId": ""
}```
- name (required): Name of the user.
- parentId (optional): ID of the parent user.### Distribute earnings
- URL: https://multi-level-marketing.onrender.com/distribute
- Method: POST
- Request Body:
```bash
{
"userId": "",
"amount": 1000
}
```
- userId (required): ID of the user.
- amount (required): Amount to be distributed.### Get all users
- URL: https://multi-level-marketing.onrender.com/users
- Method: GET### Testing
- You can use tools like Postman or cURL to test the API endpoints.