Follow these steps to get a development environment running:
-
Clone the repository:
git clone https://github.com/arianxesl/diginext-back.git cd diginext-back
-
Install dependencies:
npm install
-
Set up the database:
- Ensure SQLite is installed on your machine.
- Initialize the database using the schema provided in
database.sql
.
sqlite3 following_system.db < database.sql
Start the Node.js server with the following command:
node app.js
The server will start running on http://localhost:3000
.
Use Postman or any other API testing tool to interact with the following endpoints:
- URL:
http://localhost:3000/follow
- Method: POST
- Headers:
Content-Type: application/json
- Body:
{ "user_id": 1, "follow_id": 2 }
- URL:
http://localhost:3000/unfollow
- Method: POST
- Headers:
Content-Type: application/json
- Body:
{ "user_id": 1, "follow_id": 2 }
- URL:
http://localhost:3000/followers/2
- Method: GET
- Headers:
Content-Type: application/json
- URL:
http://localhost:3000/mutual_followers
- Method: POST
- Headers:
Content-Type: application/json
- Body:
{ "user_id1": 1, "user_id2": 3 }
- Node.js
- Express.js - Web framework for Node.js
- SQLite - SQL database engine