Welcome to the Expense Tracker Backend API! This Laravel project serves as the backend for managing expenses, providing authentication using Laravel Passport.
To interact with the Expense Tracker API, you'll need to authenticate. The authentication is handled using Laravel Passport, and the following endpoints are available:
-
Register:
POST /api/register
- Create a new user account.
-
Login:
POST /api/login
- Obtain an access token for subsequent requests.
-
Logout:
POST /api/logout
- Logout and invalidate the current access token. (Requires authentication)
Once authenticated, you can manage expenses through the following endpoints:
- Endpoint:
POST /api/expenses
- Description: Create a new expense.
- Request Body:
{ "amount": 50.0, "description": "Dinner", "date": "2023-12-12", "category": "Food" }
- Endpoint:
GET /api/expenses
- Description: Get a list of all expenses.
- Authentication: Required
- Endpoint:
PATCH /api/expenses/{expense_id}
- Description: Update an existing expense.
- Request Body:
{ "amount": 60.0, "description": "Dinner with friends", "date": "2023-12-12", "category": "Food" }
- Endpoint:
DELETE /api/expenses/{expense_id}
- Description: Delete an existing expense.
- Authentication: Required
-
Clone the repository:
git clone https://github.com/govind72/expense-tracker.git
-
Install dependencies:
composer install
-
Copy the .env.example file to .env and configure your database:
cp .env.example .env
-
Generate the application key:
php artisan key:generate
-
Run migrations:
php artisan migrate
-
Install Passport:
php artisan passport:install
-
Start the development server:
php artisan serve
Your Expense Tracker API is now running at http://localhost:8000.