This is the backend service for the Workout App, responsible for handling connections to the database and providing API endpoints for workout and user management.
-
Clone the repository:
git clone https://github.com/BryanElmer/WorkoutApp_Backend.git cd WorkoutApp_Backend -
Install dependencies:
npm install
-
Set up environment variables. Create a
.envfile in the root of your project and add the following:PORT=your_port_number MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key
-
Run the server:
npm start
-
The backend will be available at
http://localhost:PORT.
-
GET all workouts
GET /api/workouts/
-
GET a single workout
GET /api/workouts/:id
-
POST a new workout
POST /api/workouts/
-
DELETE a workout
DELETE /api/workouts/:id
-
PATCH (update) a workout
PATCH /api/workouts/:id
-
POST login route
POST /api/user/login
-
POST signup route
POST /api/user/signup
PORT: Port number.MONGO_URI: Connection string for MongoDB.JWT_SECRET: Secret key for JWT authentication.
The backend is deployed on Vercel. To deploy your own version, follow these steps:
-
Install the Vercel CLI:
npm install -g vercel
-
Deploy the project:
vercel
Follow the prompts to complete the deployment.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature-branch). - Open a Pull Request.