README
🔧 Flatify Server
This is the backend server for Flatify, a roommate/flat listing and management web application.
It is built using Express.js and MongoDB, and deployed on Vercel.
🌐 Live API
✅ Base URL:
https://flatify-server.vercel.app
✅ Example endpoints:
- Get all listings →
/flatify - Get featured listings →
/featured - Get all reviews →
/reviews - Get all banners →
/banner
🚀 Features
- ✅ RESTful API for:
- All listings:
/flatify - Single listing by ID:
/flatify/:id - User-specific listings:
/flatify/mylisting/:email - Like a listing:
/flatify/like/:id - Featured listings:
/featured - Reviews:
/reviews - Banner content:
/banner
- All listings:
- ✅ MongoDB Atlas database integration
- ✅ CORS enabled for frontend access
- ✅ Environment variable support via
.env - ✅ JSON request/response format
📦 Tech Stack
| Layer | Technology |
|---|---|
| Runtime | Node.js |
| Server | Express.js |
| Database | MongoDB Atlas |
| Deploy | Vercel |
🛠️ How to Run Locally
Follow the steps below to run the Flatify Server on your local machine:
Step 1: Clone the Repository
git clone https://github.com/your-username/flatify-server.git
cd flatify-server
Replace
your-usernamewith your actual GitHub username.
Step 2: Install Dependencies
npm install
Step 3: Set Up Environment Variables
Create a .env file in the root directory and add the following:
PORT=5000
MONGODB_URI=your_mongodb_connection_string
Make sure your MongoDB URI is from a MongoDB Atlas cluster or a local MongoDB server.
Step 4: Start the Development Server
npm run dev
This assumes you have a script like
"dev": "nodemon index.js"in yourpackage.json. If not, usenode index.js.
Step 5: Test the API
Once the server is running, go to:
http://localhost:5000/flatify
You should see the JSON data returned from the API 🎉