我们已经安装了 IDE 和 Spring Framework。是时候开始我们的项目了。我们将为 Notes 和 TODO 开发一个 REST 应用程序 API。这是每个人都需要的工具。我们将给它起一个名字:Journaler API。 Journaler API 将是一个 REST 应用程序,能够创建带有提醒的笔记和 TODO。许多不同的应用程序,例如移动应用程序,将同步到我们运行此 REST 应用程序的后端实例。
开发的第一步是初始化 Git 存储库。 Git 将是我们的代码版本控制系统。由您决定是否将 GitHub、BitBucket 或其他东西用于远程 Git 实例。创建您的远程存储库并将其 URL 与您的凭据一起准备好。那么,让我们开始吧!
以下是设置 Git 的步骤:
- Go into the directory containing the project.
- Execute the following command:
- The console output will be something like the following:
- 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:
- The console output will be something like the following:
- Use the remote Git repository URL that you have prepared previously with credentials, and execute the following command:
- This sets the new remote.
- Execute the following command to verify the new remote URL:
- Finally, push everything we have to remote, by executing the following command:
- If you are asked for credentials, enter them and confirm by pressing Enter.