This repository contains a Fastify API server that provides WebSocket functionality. Below are the instructions on how to run the server and access the client interfaces using Postman and Swagger.
-
Clone this repository to your local machine:
git clone https://github.com/sarahassan0/Fastify-API.git
-
Navigate into the project directory:
cd Fastify-API
-
Install dependencies:
npm install
-
Add .env file:
JWT_SECRET=secretkey DB_URI=mongodb://localhost:27017/db_name
To start the Fastify API server, run the following command:
npm start
This will start the server at http://localhost:5000
.
-
Download and install Postman if you haven't already.
-
Import the provided Postman collection for WebSocket testing using the following link: Fastify API WebSocket Collection
-
Once imported, you can find the WebSocket endpoints in the imported collection for testing.
Swagger documentation provides an interactive interface for exploring and testing the API endpoints.
-
After starting the server, navigate to the following URL in your browser:
http://localhost:5000/docs
-
This will open the Swagger UI interface where you can explore and test the API endpoints.