Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Expense Tracker

Overview

The Expense Tracker application allows users to manage their expenses and view them in a dashboard with visual representations using charts. It includes functionality for user registration, login, and expense management.

Table of Contents

  1. Prerequisites
  2. Installation
  3. Configuration
  4. Running the Application
  5. Endpoints
  6. Troubleshooting
  7. License

Prerequisites

Installation

  1. Clone the Repository git clone cd

  2. Install Dependencies

    Install the necessary Node.js modules:

    npm install

  3. Set Up the Database

    • Ensure MySQL is installed and running.
    • Create a new database for the application or use an existing one.

    Database Configuration:

    • Copy the example environment file and update the database credentials:

    • Edit .env file with your database credentials:

      DATABASE_HOST=localhost DATABASE_USER=root DATABASE_PASSWORD=your_password DATABASE=expense_tracker SESSION_SECRET=your_session_secret

    • Create the database and tables by running the SQL commands provided.

Configuration

  1. Environment Variables

    The application relies on environment variables for configuration. Ensure you have a .env file in the root directory with the following variables:

    DATABASE_HOST=your_database_host DATABASE_USER=your_database_user DATABASE_PASSWORD=your_database_password DATABASE=your_database_name SESSION_SECRET=your_session_secret

  2. Static Files

Place your static HTML, CSS, and JavaScript files in the public directory. Ensure that home.html, login.html, register.html, and dashboard.html are present.

Running the Application

  1. Start the Server

    Run the following command to start the server: npm start

    By default, the server will start on http://localhost:3000.

  2. Access the Application

Endpoints

  • POST /login: Authenticate a user and start a session.
  • POST /register: Register a new user.
  • POST /expense: Add a new expense.
  • DELETE /expense/:id: Delete an existing expense.
  • GET /categories: Fetch all expense categories.
  • POST /logout: Log out the current user.

Troubleshooting

  • 404 Errors: Ensure the path in your HTML links is correct. They should point to the root (e.g., Home).
  • Database Connection Issues: Verify your .env file for correct database credentials and ensure MySQL is running.
  • Session Issues: Check if cookies are enabled in your browser and ensure the session configuration is correct.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages