Skip to content

Latest commit

 

History

History
56 lines (46 loc) · 2.11 KB

README.md

File metadata and controls

56 lines (46 loc) · 2.11 KB

ToDo-API

An API for creating and managing tasks.

The API can perform following operations:

  • Create a new task-list.
  • Update a task-list.
  • Fetch a task-list.
  • Delete a task-list.
  • Create a new task in a task-list.
  • Update a task in a task-list.
  • Fetch a task.
  • Fetch all tasks in a task-list.
  • Delete a task in a task-list.

Please see the openapi contract for API endpoints and details.

Prerequisites

Install Java 11

  • This application requires Java 11.
  • Please refer to the following link to download and install Java-11: Java-11

Install & Setup Database

  • This application requires MySQL 8.
  • Please refer to the following link to download and install MySQL-8: MySQL-8
  • To create database and user you can run following script: db_setup.sql

Running the application

  • Clone the repository.
  • Open the project in IntelliJ IDEA or any suitable IDE of your choice.
  • Add following environment variables in configurations:
    • DB_HOST
    • DB_NAME
    • DB_PASSWORD
    • DB_PORT
    • DB_USERNAME
  • In IntelliJ IDEA, environment variables can be added from Run -> Edit Configurations -> Environment Variables
  • Run the project.

Build & run with Docker on Ubuntu

  • Install Docker from: Docker

  • In terminal switch to project directory.

  • Use following command: docker build -t todo-api:1.0.0 .

  • Above command will build the image.

  • Now run the following command:

    sudo docker run todo-api:1.0.0 -e "DB_HOST=<DB_HOST>" -e "DB_PORT=<DB_PORT>" -e "DB_NAME=<DB_NAME>" -e "DB_USERNAME=<DB_USERNAME>" -e "DB_PASSWORD=<DB_PASSWORD>" -p 8080:8080 -d

  • Change the actual variable value in angle brackets.

  • It will spin up a container which can be accessed on http://localhost:8080/

Pending Work

  • Unit Testing
  • How to deploy with docker on ubuntu
  • How to deploy with Azure Web App Service
  • Authorization & Authentication