This is a Spring Boot Maven Application.
Initial Commit: Spring Initializr project using from https://start.spring.io/
curl -X POST http://localhost:8080/users -H 'cache-control: no-cache' -H 'content-type:application/json' -d '{"email": "test1","password": "test1"}'
curl -X GET \ http://localhost:8080/users
curl -X POST
http://localhost:8080/user/1/note
-H 'authorization: Basic dGVzdDE6dGVzdDE='
-H 'cache-control: no-cache'
-H 'content-type: application/json'
-d '{
"note": "note for user 1",
"title": "title for user 1"
}'
curl -X GET
http://localhost:8080/user/1/note/
-H 'authorization: Basic dGVzdDE6dGVzdDE='
-H 'cache-control: no-cache'
-H 'content-type: application/json'
curl -X GET
http://localhost:8080/user/1/note/1
-H 'authorization: Basic dGVzdDE6dGVzdDE='
-H 'cache-control: no-cache'
-H 'content-type: application/json'
curl -X POST
http://localhost:8080/user/1/note/1
-H 'cache-control: no-cache'
-H 'content-type: application/json'
-d '{
"note": "trying to update the note",
"title": "trying to update the note"
}'
curl -X DELETE
http://localhost:8080/user/2/note/1
-H 'authorization: Basic dGVzdDI6dGVzdA=='
-H 'cache-control: no-cache'
-H 'content-type: application/json'
http
.csrf().disable().headers().frameOptions().sameOrigin().and()
.authorizeRequests()
.antMatchers("/users/**").permitAll()
.anyRequest().authenticated()
.and()
.httpBasic();
It pulls details from User Table to verify the credentials.
-
NoteController
-
UserController
### Add: my sql connector dependecny in pom
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
### Add: add properties in application.properties
spring.datasource.url=jdbc:mysql://localhost:3306/restapi
spring.datasource.username=root
spring.datasource.password=
Adding of Junit is a mandate but leaving it as such as of now cosnidering the time duration expected by this task is over. Adding negative scenarios handling Adding Javadoc