If you haven't already cloned the repository, do so using the following command:
git clone <repository-url>
cd blogspacecd backendRun the following command to install the required dependencies:
npm installCreate a .env file in the backend directory with the following variables:
MONGO_URI=mongodb://localhost:27017/blogspace
PORT=5000
JWT_SECRET=your_jwt_secret_keyMONGO_URI: The MongoDB connection string.PORT: The port on which the backend server will run.JWT_SECRET: A secret key for signing JSON Web Tokens (JWT). Replaceyour_jwt_secret_keywith a secure random string.
Run the following command to start the backend server:
node index.jsThe backend server will start at http://localhost:5000.
cd ../frontendRun the following command to install the required dependencies:
npm installCreate a .env file in the backend directory with the following variables:
(This will only work if you add the VITE_)
VITE_API_URL='http://localhost:5000/api'Run the following command to start the frontend development server:
npm run devThe frontend will start at http://localhost:5173 (or another port if 5173 is already in use).
- Frontend: Open your browser and navigate to
http://localhost:5173. - Backend: The backend API is available at
http://localhost:5000.
- Sign Up: Create a new account using the signup page.
- Sign In: Log in with the created account.
- Create Blog: Create a new blog post.
- View Blogs: View all blogs on the home page.
- Delete Blog: Delete a blog post from "My Posts."
- Ensure MongoDB is running locally on your machine. If not, start MongoDB using the following command:
mongod
- If you encounter any issues, check the logs in the terminal for both the frontend and backend.
Let me know if you need further assistance!