Skip to content

untalsanders/blog-api

Repository files navigation

Blog RESTful API

🏁 How To Start

  1. Install Java 17, go link for install SDKMAN

    sdk install java x.y.z-vendor
  2. Set it as your default JVM

    export JAVA_HOME='$HOME/.sdkman/candidates/java/current'
  3. Clone this repository:

    git clone https://github.com/untalsanders/blog-api.git
  4. Run application

    # Dev Environment
    ./gradlew bootRun --args='--spring.profiles.active=dev --server.port=8080'
    # Prod Environment
    ./gradlew bootRun --args='--spring.profiles.active=prod --server.port=8080'

    To production you must provide as following variables environment, e.g.

    • DB_HOST=127.0.0.1
    • DB_PORT=5432
    • DB_USER=postgres
    • DB_PASS=12345
    • DB_NAME=my_db

    Example:

    # Prod Environment
    DB_HOST=localhost DB_PORT=5432 DB_USER=postgres DB_PASS=12345 DB_NAME=blog ./gradlew bootRun --args='--spring.profiles.active=prod --server.port=8080'

🐳 Build and Run with Docker

  1. Build Image

    # Build image
    docker build -t sandersgutierrez/blog-api:latest .
  2. Run a container

    # Create and run a container
    docker run -p 8080:8080 --name blog-app \
        --env PORT=8080 \
        --env DB_HOST=localhost \
        --env DB_PORT=5432 \
        --env DB_NAME=blog \
        --env DB_USER=postgres \
        --env DB_PASS=12345 \
        sandersgutierrez/blog-api:latest

🐺 Author

🔓 License

This project is software licensed under the BSL 1.0 license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published