-
Start your PostgreSQL service and create a new database
CREATE DATABASE <your_database_name>;
-
Edit .env files in your project root according to your environment
-
In your terminal, run the following command
npm install npm run migration:run # Create all Tables
-
Create a directory 'uploads' in the project root
mkdir uploads
-
Finally, you can run the API with the following command
npm start
Method | URI | Description |
---|---|---|
GET | / | action: return all exchanges pagination: without pagination system accept query: status(active or deactive) |
GET | /exchanges | action: return all exchanges pagination: with pagination accept query: page(number), per_page(number), status(active or deactive), sort(username or title or createdAt or updatedAt) default value: page=1, per_page=10, sort=updatedAt |
POST | / | action: create a new exchange payload: username(string), contact(string), title(string), searchFor(text as string), photos(list of images) return: the current data pass to the database |
PUT | /activate | action: set an exchange to active mode query params needed: the exchanges id(string) |
PUT | /deactivate | action: set an exchange to deactive mode query params needed: the exchanges id(string) |