This repo creates an API for a Flutter app that performs CRUD (create, read, update, and delete) operations for User and Post models. The API is deployed on Render, a cloud platform for web apps.
- Backend code is written in
TypeScript - Database:
MongoDB - Server framework:
Express (for Node.js)
To run this project, you need to have Node.js and npm installed on your machine. You also need to have a MongoDB database running locally or remotely.
First, clone this repository and navigate to the project folder:
git clone https://github.com/arnavaggarwal2012/tweez-backend.git
cd your-project Then, install the dependencies using npm:
npm install Next, create a .env file in the root directory of the project and add the following variables:
MONGODB_URI=mongodb://localhost:27017/your-database # the connection string for the database You can change these values according to your preferences.
To start the server, run the following command:
npm startClick Run in Postman button to fork collection used in this Project
User requests flow through the router to the controller, who talks to the repository for data. Repository intrects with database. Then prepares a response sent back through the controller and then router to the user.
This repo 2 API resources. User and Patr. Each resource has four endpoints: GET, POST, PUT, and DELETE. There is one more route hello route. The URL for API ( will take 1 min to be active) is https://tweez-backend.onrender.com/api/v1/hello
The User resource represents a user of the app. A user has the following schema:
| Parameters | Description |
|---|---|
| userId | unique identifier for the user |
| Patrs | user post(Patrs) in array format |
| firstName | First Name of User |
| lastName | Last Name of User |
| Email of User | |
| createdAt | UTC timing of Date Time |
The Patr resource represents a Patr of the app. A user has the following schema:
| Parameters | Description |
|---|---|
| userId | unique identifier for the user |
| adminId | user post(Patrs) in array format |
| content | First Name of User |
| createdAt | Last Name of User |
These my learning from this project
- How to create APIs
- Learned about various concept of Typescript
- Lost 10+ commits while making changing repo. Learnt about git stash to avoid in future project
