Git Product home page Git Product logo

expense-tracker-api's Introduction

expense-tracker-api

REST API for tracking expenses.

A RESTful API created using Spring Boot. We have used PostgreSQL as the relational database and JdbcTemplate to interact with that. Apart from this, we have used JSON Web Token (JWT) to add authentication. Using JWT, we can protect certain endpoints and ensure that user must be logged-in to access those.

Here are all the videos where we have created this API from scratch - Youtube Playlist

Setup and Installation

  1. Clone the repo from GitHub

    git clone https://github.com/pairlearning/expense-tracker-api.git
    cd expense-tracker-api
  2. Spin-up PostgreSQL database instance

    You can use either of the below 2 options:

    • one way is to download from here and install locally on the machine
    • another option is by running a postgres docker container:
      docker container run --name postgresdb -e POSTGRES_PASSWORD=admin -d -p 5432:5432 postgres
  3. Create database objects

    In the root application directory (expense-tracker-api), SQL script file (expensetracker_db.sql) is present for creating all database objects

    • if using docker (else skip this step), first copy this file to the running container using below command and then exec into the running container:
      docker container cp expensetracker_db.sql postgresdb:/
      docker container exec -it postgresdb bash
      
    • run the script using psql client:
      psql -U postgres --file expensetracker_db.sql
      
  4. (Optional) Update database configurations in application.properties

    If your database is hosted at some cloud platform or if you have modified the SQL script file with some different username and password, update the src/main/resources/application.properties file accordingly:

    spring.datasource.url=jdbc:postgresql://localhost:5432/expensetrackerdb
    spring.datasource.username=expensetracker
    spring.datasource.password=password
  5. Run the spring boot application

    ./mvnw spring-boot:run

    this runs at port 8080 and hence all enpoints can be accessed starting from http://localhost:8080

expense-tracker-api's People

Contributors

pairlearning avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

expense-tracker-api's Issues

PSQL Exception

Hi,

I am working with your tutorial.

I can't seem to find the reason I keep getting an PSQL Exception from my UserResource, specifically from the line
User user = userService.registerUser(firstName, lastName, email, password);

Why is that? What can I do?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.