Giter Club home page Giter Club logo

news-api's Introduction

Building the app

mvn clean package

will compile the app, run the unit tests and produce an uber-jar in the target folder.

Running with maven

The following command will run the app from the compiled sources. You'll need a running postgres db as described in the next section.

mvn spring-boot:run

The following command will run a version of the application with a postgres db as a testcontainer. It will have sample news and comments created in the db.

mvn spring-boot:test-run

Running from jar

You will need a running postgres instance that you can spin up with docker-compose.

docker compose -f docker/docker-compose.yml up -d

You may stop the instance once you're finished.

docker compose -f docker/docker-compose.yml down

Once postgres is up, run the app itself:

java -jar target/news-api-0.0.1-SNAPSHOT.jar

Available commands

The rest api services manages authors, news, their categories, and comments. The following URL shows the Swagger / Open API documentation of the available end points. Here you may try out individual requests. When updating and deleting news and comments you must also specify the userId as the request parameter in the URL. It must equal the author id of the respective entity, otherwise you will get 403 Forbidden response. This logic is implemented with Spring AOP.

http://localhost:8080/swagger-ui/index.html

The next URL shows the definition of the end points in json format. It can be imported into a Postman collection, for example.

http://localhost:8080/v3/api-docs

Configuration

The app reads its configuration from the src/main/resources/application.yml file. You may override any of the parameters from the command line using the -D flag similar to the examples above.

The following configuration parameters govern the behavior of the app

news-api's People

Contributors

hrashk avatar

Watchers

 avatar  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.