1package com.zetcode.controller;
2
3import org.springframework.web.bind.annotation.PathVariable;
4import org.springframework.web.bind.annotation.RequestMapping;
5import org.springframework.web.bind.annotation.RestController;
6
7@RestController
8public class MyController {
9
10 @RequestMapping(path="/{name}/{age}")
11 public String getMessage(@PathVariable("name") String name,
12 @PathVariable("age") String age) {
13 var msg = String.format("%s is %s years old", name, age);
14 return msg;
15 }
16
17}