This is the source code for the website of Maz Realty, a real estate based in Egypt. The application is based on client/server architecture, where the client is a web browser and mobile device, and the server is a Node.js server. The server is responsible for serving the client with the website’s content and handling the requests from the client.
Live
https://mazrealty.live
1# Clone the repository
2git clone https://github.com/Adosh74/mazrealty.live
3
4# Change the directory
5cd mazrealty.live
6
7# Install the dependencies
8npm install
9
10# Install the client and server dependencies
11npm run build
12
13# Create .env file in the root directory like .env.example file
14
15# Start the whole application
16npm run start
17
18# Now the application is running on http://localhost:<the port in the .env file>
users:
POST /api/v1/users/
- Create a new userGET /api/v1/users/
- Get all usersGET /api/v1/users/:id
- Get a userPATCH /api/v1/users/:id
- Update a user (only for admin)DELETE /api/v1/users/:id
- Delete a user (only for admin)GET /api/v1/users/me
- Get the current user (only for authenticated users)PATCH /api/v1/users/updateMe
- Update the current user (only for authenticated users)PATCH /api/v1/users/updateMyPassword
- Update the current user’s password (only for authenticated users)auth:
POST /api/v1/auth/signup
- Sign up and get a tokenPOST /api/v1/auth/login
- Log in and get a tokenGET /api/v1/auth/logout
- Log out and clear the token from the cookieproperties:
POST /api/v1/properties/
- Create a new property
GET /api/v1/properties/
- Get all properties
GET /api/v1/properties/:id
- Get a property
PATCH /api/v1/properties/:id
- Update a property (only for admin and property owner)
DELETE /api/v1/properties/:id
- Delete a property
PATCH api/v1/properties/add-images/:id
- Add images to a property (only for admin and property owner)
PATCH /api/v1/properties/delete-image/:id
- Delete an image from a property (only for admin and property owner)
get all properties query options:
GET /api/v1/properties/?sort=-price
- Sort by price descendingGET /api/v1/properties/?fields=name,price
- Select only name and price fieldsGET /api/v1/properties/?limit=5
- Limit the number of results to 5GET /api/v1/properties/?page=2&limit=5
- Pagination, get the second page with 5 resultsuser favorites:
POST /api/v1/users/favorites/:id
- Add a property to favorites (only for authenticated users)DELETE /api/v1/users/favorites/:id
- Remove a property from favorites (only for authenticated users)GET /api/v1/users/favorites
- Get all favorite properties of the current user (only for authenticated users)lawyer:
GET /api/v1/lawyers/not-approved
- Get all lawyers that are not approved (only for lawyer and admin)PATCH api/v1/lawyers/approve-property/:id
- Approve a lawyer (only for lawyer and admin)cities:
GET /api/v1/cities/
- Get all citiessocket events:
newUser
- when is connected and authenticated (pass the userId)
sendMessage
- when a user sends a message (
pass the object having {
receiverId: receiverId from response,
data: all response
}
)