Giter VIP home page Giter VIP logo

expense-tracker-api's Introduction

Expense Tracker API

A simple REST API created using Spring Boot and MySql.

Run Locally

Clone the project

  git clone https://github.com/arsan13/expense-tracker-api.git

Go to the project directory

  cd expense-tracker-api

Create a database

  CREATE DATABASE database_name

Configure database properties in "application.properties" file as per your need

  spring.datasource.url=jdbc:mysql://localhost:3306/expense_tracker
  spring.datasource.username=root
  spring.datasource.password=

Build and Run the app

  mvn spring-boot:run

The app will start running at http://localhost:8080

Swagger - API Documentation

Cilck here to know more about Swagger

Explore REST APIs

User Authentication

Method URL Description Return
POST api/users/register/ Sign-up JSON Web Token
POST api/users/login/ Login JSON Web Token

Categories

Method URL Description Return
GET api/categories/ Get all categories Array of JSON objects
GET api/categories/{id} Get a category by id Single JSON object
POST api/categories/ Create a new category Created JSON object
PUT api/categories/{id} Update an existing category Updated JSON object
DELETE api/categories/{id} Delete a category Success message

Transactions

Method URL Description Return
GET api/categories/{cid}/transactions/ Get all transactions of "cid" category Array of JSON objects
GET api/categories/{cid}/transactions/{tid} Get a single transaction by "tid" of category "cid" Single JSON object
POST api/categories/{cid}/transactions/ Insert a new transaction for the category "cid" Created JSON object
PUT api/categories/{cid}/transactions/{tid} Update an existing transaction Updated JSON object
DELETE api/categories/{cid}/transactions/{tid} Delete a transaction Success message

NOTE:
The endpoints of "Categories" and "Transactions" are restricted. To access those endpoints, use the token which is generated after logging-in as the value of the Bearer in the Authorization header as follows:
"Authorization: Bearer Token_id"

Sample Request Body

User - Register

  {
    "firstName": "Thomas",
    "lastName": "Shelby",
    "email": "[email protected]",
    "password": "test123"
  }

User - Login

  {
    "email": "[email protected]",
    "password": "test123"
  }

Categories

  {
    "title": "Shopping",
    "description": "All shopping expenses in xyz mall"
  }

Transactions

  {
    "amount": 4000,
    "note": "Spent higher than last time",
    "transactionDate" : "2021-19-09"
  }

expense-tracker-api's People

Contributors

arsan13 avatar

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.