Skip to content

crocarneiro/backend-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

36 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Back-end Challenge ๐Ÿ… 2021 - Space Flight News

This application is an API for updating and consuming a database with articles about space flight news. It syncs every day with the Space Flight API, but it's possible to add, update and remove articles.

This is a challenge by Coodesh

Tech Stack

Demo

You can test the API in our online Swagger UI.

Presentation

I talk a little bit about this application in this video right here: https://www.loom.com/share/aacf4b7e800742cbbd48faa8a08f9177.

Running the application with Docker Compose

Open a terminal session, navigate to the Docker folder in this directory and run the following command:

docker-compose up

That's it. The API is now accessible through the URL localhost:8080/.

Running the application manually

You can download the jar file from one of the releases: https://github.com/crocarneiro/backend-challenge/releases

Or you can build the application yourself.

Building

To build the application just make sure you have a distribution of the JDK 17 and the latest Maven version installed, then open the root folder of the repository in your terminal and run:

mvn package

Running

Once you have a valid build of the the application you can run it with the following command:

java -jar backend_challenge-0.0.1-SNAPSHOT.jar # The .jar name may change

This application works with two profiles: "production" and "dev". The default profile is "production", so before running the application you have to set the environment variable "MONGO_DATABASE_URL" with the URL connection of your MongoDB instance.

Linux:

export MONGO_DATABASE_URL={your_URL_here}

Windows:

set MONGO_DATABASE_URL={your_URL_here}

To run the application in a development environment run the following command:

java -jar -Dspring.profiles.active=dev backend_challenge-0.0.1-SNAPSHOT.jar # The .jar name may change

If you have the env variable MONGO_DATABASE_URL set, then the application will connect to this database, otherwise it will start a Mongo Container by itself and use it.

So the options are:

  1. You set up a Mongo DB instance by yourself: You have to set the var MONGO_DATABASE_URL.
  2. You don't want to set up a instance by yourself: Do not set the var MONGO_DATABASE_URL, but you have to have Docker installed and running in your machine.
  3. In production you do not have options: You have to set the var MONGO_DATABASE_URL.

About

Back-end Challenge 2021 ๐Ÿ… - Space Flight News

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages