/spring-boot-api-for-beginners

Beginner-friendly intro to web services with Spring Boot

Primary LanguageJava

From 'A' to 'Web App': Build an API in Java

I wrote this tutorial to fill a void that I have noticed. Building web applications is a top priority for people learning backend development, but I haven’t seen any Java or Spring Boot tutorials that is friendly for beginners. Most tutorials are either too trivial (Hello World API) to help you understand what you need to know; or they are overwhelming and assume too much about what you already know!

The second part of the tutorial covers testing this web service. The corresponding code is contained in the "with-tests" branch, the code differs slightly from the "master" branch, and includes the unit tests discussed.

What you’ll build

You’ll build a web service that can create, read, update, and delete users.

get request example

The default local address for your Spring Boot application will be: http://localhost:8080, so the address to get all users would be http://localhost:8080/users for example.

We will create the following actions:

HTTP Method Address Action
GET /users Get all users
GET /users/{id} Get users by id
GET /users?name=rob+oleary Get user by name
POST /users Add a new user
PUT /users Update a user
DELETE /users/{id} Delete a user

The tutorial outlines prerequisites and provides a step-by-step guide to building the web serivce.

Show appreciation

If the tutorial was helpful, please star the repo 🌟, and recommend it to others.

You can show your appreciation by buying me a coffee or sponsoring me. This will offer me encouragement to continue making educational content like this.

buy me a coffee