Skip to content

Ami-hub/Sample-RESTful-API

Repository files navigation

❤️‍🔥 RESTful API Sample Project

A sample RESTful API based on the data of Mflix sample dataset using typescript, mongoDB, and fastify. The API provides an easy way to perform CRUD operations on the data, with fast response times.
Feel free to use it as a template for your own projects or as a reference for learning.

sample-api-logo

📖 Documentation

For the documentation about supported endpoints and their usage, please import this collection to your Postman app. The collection contains all the information you need to use the API, including detailed examples.



🚀 Quick start or quick start with Docker

📚 Prerequisites


🔥 Let's get started!

⬇️ Clone the repo from github

git clone https://github.com/Ami-hub/Sample-RESTful-API.git

🚗 Go to the app directory

cd Sample-RESTful-API

📦 Install dependencies

npm i

⚙️ Set up the environment variables

  1. Create a .env file based on the .env.example file:
    🐧 Linux:

    cp .env.example .env
    

    🪟 Windows:

    copy .env.example .env
    
  2. Modify the .env file to match your needs and environment, see environment variables documentation.
    For example:

    MONGODB_URI=mongodb+srv://name:pass@cluster0.1a2b3c4.mongodb.net/
    DB_BASE_NAME=sample_mflix
    LOG_LEVEL=trace
    ...

🛠️ Build the app

npm run build

👟 Run the app

npm run start

🎉 Done!

You can open your browser and go to http://localhost:3000/api (or whatever port you chose) to see the welcome message.

You should see the following message:

{
  "message": "Welcome to the API"
}


🏰 Visit my deployed version here!



✍🏽 Authors



🪪 License