Skip to content

Commit d1f9ac3

Browse files
committed
added hello route
1 parent 7087080 commit d1f9ac3

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
Basic [Java Spring Boot](https://spring.io/projects/spring-boot) application
44

5+
# How to Run
56

7+
1. use IDE or use command: ```mvnw spring-boot:run``` from project root
68
## To Do
79

8-
- [ x ] [setup IntelliJ IDE](https://www.youtube.com/watch?v=H_XxH66lm3U&t=84s)
9-
- [ ] create a basic application using [sprint initializer](https://start.spring.io/)
10+
- [x] [setup IntelliJ IDE](https://www.youtube.com/watch?v=H_XxH66lm3U&t=84s)
11+
- [x] create a basic application using [sprint initializer](https://start.spring.io/)
1012
- [Video Example](https://www.youtube.com/watch?v=df7Dso9q700&t=565s)
1113
- [ ] add basic junit tests
1214
- [ ] add cucumber tests/reports

src/main/java/com/example/JavaSpringBoot/JavaSpringBootApplication.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.web.bind.annotation.GetMapping;
6+
import org.springframework.web.bind.annotation.RequestParam;
7+
import org.springframework.web.bind.annotation.RestController;
58

69
@SpringBootApplication
10+
@RestController
711
public class JavaSpringBootApplication {
812

913
public static void main(String[] args) {
1014
SpringApplication.run(JavaSpringBootApplication.class, args);
1115
}
1216

17+
// http://localhost:8081/hello?name=Anish
18+
@GetMapping("/hello")
19+
public String hello(@RequestParam(value = "name", defaultValue = "World") String name) {
20+
return String.format("Hello %s!", name);
21+
}
22+
1323
}

0 commit comments

Comments
 (0)