File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
src/main/java/com/example/easynotes/controller Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 1
1
package com .example .easynotes .controller ;
2
-
3
-
2
+ import lombok .extern .slf4j .Slf4j ;
3
+ import org .slf4j .Logger ;
4
+ import org .slf4j .LoggerFactory ;
4
5
import org .springframework .web .bind .annotation .GetMapping ;
5
6
import org .springframework .web .bind .annotation .RequestMapping ;
6
7
import org .springframework .web .bind .annotation .RestController ;
7
8
8
9
@ RestController
9
10
@ RequestMapping ("/" )
11
+ @ Slf4j
10
12
public class IndexController {
11
13
12
14
@ GetMapping
13
15
public String sayHello () {
14
- return "Hello and Welcome to the EasyNotes application. You can create a new Note by making a POST request to /api/notes endpoint." ;
16
+ try {
17
+ log .info ("/ API hit" );
18
+ return "Hello and Welcome to the EasyNotes application. You can create a new Note by making a POST request to /api/notes endpoint." ;
19
+ } catch (Exception e ){
20
+ log .error ("Error:{}" ,e );
21
+ return "Contact Administrator" ;
22
+ }
23
+
15
24
}
16
25
}
You can’t perform that action at this time.
0 commit comments