This is the first part of a series where I'll guide you through deploying an app locally before moving to the cloud.
The assumption is that you already have an app built and are ready for deployment. I'll be skipping the testing phase as the app for this demonstration is simple enough not to require extensive testing.
The Project Set-up
Before we begin, ensure you have:
- Java installed on windows, MacOS, Linux
- Maven set up
For this tutorial, I've created a simple Weather App. You can fork the repository from here. It is a really super simple application.
Important Note: After cloning the repo, you'll need to add your API key from OpenWeather as the application requires it. Once you have your API key, add it to the application.properties file, which is located inside the src/main/resources
directory, where the api.key field is located. The API is free; you don't have to pay for anything.
Open your preferred IDE (I'm using VS Code) and load the application. Your project structure should look something like this:
Also update the api.key
value with your OpenWeather API key.
Once done, open the integrated terminal and run the mvn spring-boot:run
command and see if the application runs perfectly. It should run perfectly; if not, write in the comment what went wrong, and I will try to help you out. You should see the following output once the execution starts.
I am using port 8001 for this project, but if the port is occupied by another process, you can change it and update the server.port
value in the application.properties
file.
Open up a browser and enter the URL localhost:<YOUR PORT NUMBER>
in this case localhost:8001
and you will have the app running.
Enter any city that you want to check the weather in, and it will show you.
What's Next?
Now that we have the application working locally, it's time to deploy it to the cloud.
Continue to Part 2 for the cloud deployment guide.
Top comments (0)