Code Monkey home page Code Monkey logo

notepad's Introduction

Notepad: Simple Spring Boot App

This simple application is used for demo purposes. It exposes the actuator endpoints as well as the /notes endpoint, which creates a note when it gets a POST request.

Usage

The Notepad stores the notes in a MySQL instance, so it expects the MySQL database to be up and running. The bellow command starts a MySQL container with a newly created database notepad in it. It also sets up the mysql root password as root.

$ docker run -d --name mysql -e MYSQL_DATABASE=notepad -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 mysql:5.7

Now, clone this repository and go into the notepad directory:

$ git clone https://github.com/jorgeacetozi/notepad.git $ cd notepad

Once you succesfully cloned the repository, start the application the jar artifact:

$ mvn clean install

Wait for the unit and integration tests to run and the artifact to be generated. Eventually it will be stored in the target/ directory.

Now, start the application:

$ java -jar $(ls target/*.jar)

Check that the application is up and running hitting the actuator /health endpoint:

$ curl http://localhost:8080/health

Create a new note:

$ curl -H "Content-Type: application/json" -X POST -d '{"title":"Kubernetes","content":"Best container orchestration tool ever"}' http://localhost:8080/notes

Features

  • Flyway to manage database migrations.
  • maven-surefire-plugin to run only unit tests with mvn test.
  • maven-failsafe-plugin to run unit and integrations tests with mvn verify.
  • 1 simple unit test, 2 integrations tests (a api test to ensure that the JSON returned by the endpoint is correct) and a database test (saves a note and ensures that it was successfuly persisted in MySQL).
  • maven-release-plugin to release new application versions in GitHub.

notepad's People

Contributors

jorgeacetozi avatar

Watchers

 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.