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.
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
git clone https://github.com/Ami-hub/Sample-RESTful-API.git
cd Sample-RESTful-API
npm i
-
Create a
.env
file based on the.env.example
file:
🐧 Linux:cp .env.example .env
🪟 Windows:
copy .env.example .env
-
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 ...
npm run build
npm run start
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"
}