/Fastify-API

Primary LanguageJavaScript

Fastify-API

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.

Installation

  1. Clone this repository to your local machine:

    git clone https://github.com/sarahassan0/Fastify-API.git
  2. Navigate into the project directory:

    cd Fastify-API
  3. Install dependencies:

    npm install
  4. Add .env file:

    JWT_SECRET=secretkey
    DB_URI=mongodb://localhost:27017/db_name

Running the Server

To start the Fastify API server, run the following command:

npm start

This will start the server at http://localhost:5000.

Accessing the Client Interface - Postman (WebSocket)

  1. Download and install Postman if you haven't already.

  2. Import the provided Postman collection for WebSocket testing using the following link: Fastify API WebSocket Collection

  3. Once imported, you can find the WebSocket endpoints in the imported collection for testing.

Postman collection Postman collection

Accessing the Swagger Documentation

Swagger documentation provides an interactive interface for exploring and testing the API endpoints.

  1. After starting the server, navigate to the following URL in your browser:

    http://localhost:5000/docs
    
  2. This will open the Swagger UI interface where you can explore and test the API endpoints.

Swagger collection

Author

Sarah Hassan