0Pricing
Spring Boot 4 Microservices & REST APIs · Ders

İlk REST Uç Noktanızı Oluşturma

Basit bir 'Hello World' REST uç noktası oluşturun ve temel denetleyici ek açıklamalarını öğrenin.

İlk REST Uç Noktanızı Oluşturma, CoddyKit'te ücretsiz bir Spring Boot 4 Microservices & REST APIs dersidir. Bu, 3 dersinin 2. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Spring Boot 4 Microservices & REST APIs öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Spring Boot 4 Microservices & REST APIs kursu toplamda 3 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

What's a REST Endpoint?

An endpoint is a specific URL where your app can be reached — a unique doorbell for one function. Our goal: build one that says “Hello!”

Spring Boot Makes REST Easy

Spring Boot is great for REST APIs: minimal setup, an embedded server like Tomcat, and convention over configuration — less boilerplate, more building.

Meet @RestController

@RestController marks a class to handle web requests and return data directly. It bundles @Controller with @ResponseBody — the core REST building block.

Code Your First Endpoint

Let’s code a Hello CoddyKit! endpoint at the root path /. Run it to see your first Spring Boot API respond.

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class FirstApiApplication {

    public static void main(String[] args) {
        SpringApplication.run(FirstApiApplication.class, args);
    }

    @GetMapping("/")
    public String hello() {
        return "Hello CoddyKit!";
    }
}

Decoding @GetMapping

@GetMapping("/") maps HTTP GET requests to a method, and the path in parentheses sets the URL. So a GET to / calls hello().

Running Your Application

On run, Spring Boot starts an embedded Tomcat on port 8080, scans for annotations like @RestController and @GetMapping, and registers your endpoints.

Test Your Endpoint!

Now test it: open http://localhost:8080/ in a browser (or curl it) and you’ll see “Hello CoddyKit!” — your first live endpoint.

Mapping Specific Paths

Want more endpoints? Just give each @GetMapping a different path. Here we add a second one at /greet.

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class FirstApiApplication {

    public static void main(String[] args) {
        SpringApplication.run(FirstApiApplication.class, args);
    }

    @GetMapping("/")
    public String hello() {
        return "Hello CoddyKit!";
    }

    @GetMapping("/greet")
    public String greet() {
        return "Greetings from Spring Boot!";
    }
}

Quick Check: Endpoint Basics

Which annotation tells Spring Boot that a class is a web controller and its methods should return data directly as the response body?

Recap: Your First API

Nice work! You built your first REST API — what an endpoint is, the @RestController annotation, @GetMapping for paths, and running and hitting your app.

Sıkça Sorulan Sorular

“İlk REST Uç Noktanızı Oluşturma” dersi ücretsiz mi?

Evet — “İlk REST Uç Noktanızı Oluşturma” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Spring Boot 4 Microservices & REST APIs kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Spring Boot 4 Microservices & REST APIs kursu toplamda 3 dersten oluşur.

“İlk REST Uç Noktanızı Oluşturma” dersinde ne öğreneceğim?

Basit bir 'Hello World' REST uç noktası oluşturun ve temel denetleyici ek açıklamalarını öğrenin. Spring Boot 4 Microservices & REST APIs ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Spring Boot 4 Microservices & REST APIs öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Spring Boot 4 Microservices & REST APIs, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 3 dersinin 2. dersidir.

“İlk REST Uç Noktanızı Oluşturma” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Spring Boot 4 Microservices & REST APIs dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Spring Boot 4 Microservices & REST APIs dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Spring Boot Projenizi Kurma
  2. İlk REST Uç Noktanızı Oluşturma
  3. HTTP Yöntemlerini ve Durumlarını Anlama
← Spring Boot 4 Microservices & REST APIs Sayfasına Dön