# ATLAS - Rest API with Spring boot (part 1) ## Context ### Project abstract - A Rest API to manage countries and related resources (such as regions) - In a few words, the API will allow consumers to execute "CRUD-like" operations over resources, and retrieve statistical information regarding the resources ### Prerequisites - Basic knowledge of general programming (variables, types, data structures, loops, functions) - Basic knowledge of OOP with Java (syntax, class, objetcs, frequently used types) - Basic knowledge of HTTP, Rest API, JSON - Basic knowledge of Git and GitHub ### Learning objectives - **Team work**: learn how to work with team mates, self-organization, split the work into tasks and subtasks, prioritize the work - **Collaboration**: learn about collaborative tools such as Git and GitHub in order to share and manage the code base on the same project - **Business requirements**: learn about analyzing and understanding business requirements, do not implement more or less than the expectations - **Coding**: go further with OOP and Java, learn about Spring and Spring boot, Maven, implementation of a Rest API, validation of clients' inputs, test a Rest API with an HTTP client such as Postman. Discover Eclipse as Java IDE ### Constraints and recommendations - **Repository**: the repository must be named `simplon-atlas`, be `private` adding team mates and trainer as collaborators, with a single `main` branch - **No conflict approach**: organize the work in order to have no conflict at all in the code base. The idea is to be comfortable with Git fundamentals; and to optimize the communication within the team, identify chronological dependencies between tasks - **Requirements**: implement the requirements in the order their are listed in these specifications, of course when possible each team member can work on a separate requirement while respecting the order - **English and naming**: all the code must be in English, and must comply with all the naming conventions (Java, Rest URIs and so on) - **Verbs and HTTP status**: services must be exposed with the correct verb and return the correct HTTP response status ## Spring boot project setup and project sharing ### Eclipse - Each team member must set the same **Java formatter conventions** from the Eclipse preferences, and enable the **Java editor Save Actions** in order to format source code on save - Each team member must configure the **Java environment** of the Eclipse workspace, this can be done specifying correct version (11) in the preferences (`Installed JREs`, `Execution Environments`, JDK Compiler compliance level) - Each team member must install the `Spring Tools 4` **Eclipse plugin** from the IDE's Eclipse Marketplace ### Spring initializer - Once installed, one can create and initialize a **new Spring Starter Project** with given specifications, keep defaults for other elements: - Name: `simplon-atlas-api` - Location: it depends! - Type: `Maven` - Java Version: `11` - Group: `co.simplon` - Artifact: `atlas-api` - Description: ATLAS project Spring boot API - Package: `co.simplon.atlas.api` - Spring Boot Version: `2.7.17` - Dependencies: `Spring Web` - **Notes**: be patient during project's initialisation, Eclipse will download source code and documentation for many dependencies. Spring initializer adds a default test dependency and a default test class, leave and ignore them for the time being ### Verify and share - **.gitignore**: pay attention to the default `.gitgnore` file and add any other exclusions if required (also ignore `.DS_Store` even if you don't have a Mac and the `bin`). Remember to share only source code and configuration files - **Start/Stop**: learn how to start and stop a Spring boot application from Eclipse, one started one should have `Started SimplonAtlasApiApplication` on the last line of the console, and `Stopping service [Tomcat]` once stopped - **Share**: share the project on GitHub with your team mates, each one should be able to clone the project and run the application on its local environment. Don't forget the [constraints and recommendations](#Constraints-and-recommendations) ### What you should have learned? At this stage, each team member should be able to answer to these questions: - Why is it important to have the same formatting and execution environment configuration on a project? - What is Maven? What is the POM / pom.xml file? What is a group and an artifact in a Maven project? - What is a Java package? - What is Spring? What is a framework? What is a library? - What is Spring boot? What is Tomcat? Why do we need a *tool* such as Tomcat for our ATLAS project? - What is Spring tools (STS plugin) for?