./gradlew run
Once the application is started, it can be reached at
http://localhost:8080
The following are the rest endpoints:
HTTP Verb | URL | Description | Status Codes |
---|---|---|---|
GET |
http://localhost:8080/article/{id} |
Gets the article corresponding to the supplied article ID |
|
GET |
http://localhost:8080/articles?keyword={keyword}&author={author}&from={fromDate}&to={toDate} |
|
|
POST |
http://localhost:8080/article |
Creates a new article based on the payload contained in the request body and basic auth |
|
PUT |
http://localhost:8080/article/{id} |
Updates an existing article with the data contained in the request body |
|
DELETE |
http://localhost:8080/article/{id} |
Deletes an existing article that corresponds to the supplied article ID |
|
{
"header" : "Header for the article",
"short-description": "A short description of the article",
"text": "The content of the article",
"publishedOn": "Publish date of the article, format yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"authors": "List of authors of the article Eg: [{name:"author1"},{name: "author2"}]"
"keywords": "List of keywords for article Eg: ["keyword1", "keywords2"]"
}
Constraint: None of the above fields can be empty, all are mandatory
To build the application
`./gradlew build`
To run all tests
`./gradlew test`
- Uses basis access authentication to differentiate between an editor and user
- Improvement is to use OAuth2.0 based authorization, which is more secured since basic auth is vulnerable because the authorization is set in the header.
- Credentials are stored in properties file, which will be a devops automation generated file in prod.