Dive into the world of API development using Java and SpringBoot. We're handing over a skeleton codebase; your challenge is to shape a top-notch API from it.
You can build any API of your choosing, but it must include the following:
- At least one algorithm
- Unit test at least one class
- Store the data in a JSON file
- Exception handling
- Evidence of inheritance
- Good use of HTTP Protocols - methods, request and response, have full CRUD operations supported
- Documentation
By the end of this assessment, you should be able to:
- Design and Architect APIs: Get to grips with the nitty-gritty of curating a top-quality API, focusing on data flow and endpoint interactions.
- Implement Best Practices: Showcase your adherence to Java & SpringBoot coding standards, error handling, and optimal project structure.
- Code Integration: Seamlessly combine your creations with the provided skeleton codebase.
- Exception Management: Efficiently handle exceptions, ensuring your API remains sturdy and dependable.
Onward with this assessment, you're set for a deep dive into API development with Java and SpringBoot.
- API Flow: Map out your API's progression, from endpoints to their functionalities.
- Core: Make use of Java and SpringBoot.
- End Points: Ensure they are detailed and fully operational.
- Error Handling: Your API should handle mishaps gracefully and return informative feedback.
- Acknowledge the pivotal role of a focused design in APIs.
- See firsthand how a detailed requirements list can pave the way for successful development.
- Consistent Commits: Commit often, capturing your progress and thought process.
- README: Not just an afterthought. Fill it with the essence of your API, setup instructions, and other salient details.
- Hone your skills in effective version control.
- Recognise the value of a well-curated repository.
- Best Practices: Stick to Java and SpringBoot best practices and conventions.
- Modularity: Your code should be modular, reusable, and easily comprehensible.
- Craft clean, efficient, and maintainable code.
- Harness Java and SpringBoot to the fullest.
Before you begin, make sure you have the following installed:
Also make sure you have accounts for the following:
git clone [REPO_URL]
cd [REPO_NAME]Replace [REPO_URL] with the link to your GitHub repository and [REPO_NAME] with the repository's name.
Open a terminal at the root of the repo directory and run the following command to install the dependencies:
./mvnw clean dependency:resolveIf you are on a Windows machine, that will be:
mvnw clean dependency:resolveYou should see console output similar to the following:
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.cbfacademy:api-assessment >--------------------
[INFO] Building api-assessment 0.0.1-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ api-assessment ---
[INFO] Deleting /Users/user/Dev/cbfacademy/java-api-assessment/target
...
[truncated output]
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.060 s
[INFO] Finished at: 2023-10-03T16:18:25+01:00
[INFO] ------------------------------------------------------------------------To start the API in VS Code, press F5 or tap the 'Play' icon for the api-assessment app in the Spring Boot Dashboard.
Alternatively, to start the API from the terminal, run the following command:
./mvnw spring-boot:runOr on Windows:
mvnw spring-boot:runYou should see console output similar to the following (press Ctrl + C to exit):
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.cbfacademy:api-assessment >--------------------
[INFO] Building api-assessment 0.0.1-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ api-assessment ---
[INFO] Deleting /Users/gary/Dev/cbfacademy/java-api-assessment/target
[INFO]
[INFO] >>> spring-boot:3.1.4:run (default-cli) > test-compile @ api-assessment >>>
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ api-assessment ---
[INFO] Copying 1 resource from src/main/resources to target/classes
[INFO] Copying 0 resource from src/main/resources to target/classes
...
[truncated output]
...
2023-10-03T17:17:34.413+01:00 INFO 35536 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2023-10-03T17:17:34.751+01:00 INFO 35536 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2023-10-03T17:17:34.756+01:00 INFO 35536 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-10-03T17:17:34.756+01:00 INFO 35536 --- [ restartedMain] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.13]
2023-10-03T17:17:34.777+01:00 INFO 35536 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2023-10-03T17:17:34.778+01:00 INFO 35536 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 364 ms
2023-10-03T17:17:34.898+01:00 INFO 35536 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2023-10-03T17:17:34.907+01:00 INFO 35536 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2023-10-03T17:17:34.911+01:00 INFO 35536 --- [ restartedMain] com.cbfacademy.apiassessment.App : Started App in 0.643 seconds (process running for 0.786)Open your browser and navigate to http://localhost:8080.
Ensure that your work is merged to the main branch of your GitHub repository by the specified deadline (original or extended). Your solution will assessed based on its state at that point; any later commits will not be taken into account.
-
Q: How can I process JSON in Java?
A: There are a number of open-source packages that you can use to manipulate JSON. We recommend Gson, but you can also investigate alternatives like json-simple or Jackson.
-
Q: Can I use another IDE I'm more familiar with instead of VS Code, like IntelliJ or Eclipse?
A: You can if you wish, but only VS Code is formally supported by CBF Academy staff, so you do so at your own risk.
- πΈ Commit frequently and use meaningful commit messages. A granular, well-labelled history becomes an increasingly valuable asset over time.
- π΅ Use feature branches. Build the habit of isolating your changes for specific tasks and merging them into your default branch when complete.
- π¦ Use consistent naming conventions. Choose easily understandable names and naming patterns for your classes, functions and variables.
- π Keep your code tidy. Using the built-in formatting of VS Code or other IDEs makes your code easier to read and mistakes easier to spot.
- π Read the docs. Whether via Intellisense in your IDE, or browsing online documentation, build a clear understanding of the libraries your code leverages.
- π Don't wait until the last minute. Plan your work early and make the most of the time available to complete the assessment and avoid pre-deadline palpitations.
- π Ask. π For. π Help! π Your mentors, instructors and assistants are literally here to support you, so make use of them - don't sit and struggle in silence.
Best of luck! Remember, it's not just about the destination; it's the journey. Happy coding! π