We have installed the IDE and Spring Framework. It is time to start working on our project. We will develop a REST application API for Notes and TODOs. This is a tool that everybody needs. We will give it a name: Journaler API. Journaler API will be a REST application capable of creating Notes and TODOs with reminders. Many different applications, such as mobile ones, will be synced to our backend instance running this REST application.
The first step in development is initializing a Git repository. Git will be our code versioning system. It is up to you to decide whether you will use GitHub, BitBucket, or something else for your remote Git instance. Create your remote repository and keep its URL ready along with your credentials. So, let's start!
The following are the steps to set up Git:
- Go into the directory containing the project.
- Execute the following command:
$ git init .
- The console output will be something like the following:
Initialized empty Git repository in <directory_you_choose/.git>
- We have initialized the repository. Now let's add the first file by executing the following command:
$ vi notes.txt
- Populate notes.txt with some content and save it.
- To add all of the relevant files, execute the following commands:
$ git add .
$ git commit -m "Journaler API: First commit"
- The console output will be something like the following:
[master (root-commit) 5e98ea4] Journaler API: First commit 1 file changed, 1 insertion(+) create mode 100644 notes.txt
- Use the remote Git repository URL that you have prepared previously with credentials, and execute the following command:
$ git remote add origin <repository_url>
- This sets the new remote.
- Execute the following command to verify the new remote URL:
$ git remote -v
- Finally, push everything we have to remote, by executing the following command:
$ git push -u origin master
- If you are asked for credentials, enter them and confirm by pressing Enter.