ELN Crud/Search is a Spring Boot Java REST API for dealing with Crud and search operations on ELN entries.
In order to run the REST API, please use Maven wrapper for a quick run. (Runs on 8080
port by default).
./mvnw spring-boot:run
To run the UI, you can use the following to run on webpack-dev-server
.
cd eln-ui
npm install
npm run start
UI app runs on 3000
port by default and expects the API to be running on 8080
. If not, you can change the base URL in file /eln-ui/src/util/Constants.js
.
- Implemented the user story about searching entries by building a REST API with a method taking
entryId
andword
in the request and responds with aList
ofword
,distance
,frequency
, andoccurrences
of the found words. This design choice implied supporting the crud operations on the server side as well. In a REST API like this, sending theentry
content each time to the server (given in possible implementation) did not seem like a good practice.- Spent around 20 hours to complete the task. I am not practiced in Java/Spring and React so I had spent a lot of time around tutorials. I also revised the architecture of packaging of the backend application a few times due to the conventional differences between .NET and Java application architectures.
- 100% test coverage for
Service
,Controller
andConverter
methods. - Flexible and scalable API architecture that supports adding other resources and services. I separated the
TextService
business logic/domain fromEntryService
business logic/domain so that in the future other services may use these bounded services. - Simple validations for entities. In terms of code style, the validations in
Service
layer suffer from code smell. They need to be refactored with an AOP approach. - Simple validations for exception handling and returning relevant HTTP Response codes and error messages. Currently, many significant error handlings are missing and error response contents are incompatible with auto configurations of Spring errors.
- [] What it does not contain:
- Despite being in my plans, I did not have time to implement HATEOAS which makes this REST service deficient.
- Did not implement any Security related developments such as Authentication, checking HTTP Headers etc.
- No performance checks and monitoring implemented.
- No automated build, test, deployment configuration.
- No authentication, error handling, code refactor, cleanup, render performance optimization etc. for front-end application. It is created only for presentational purpose. I would appreciate if you don't evaluate the code style and architecture in UI code since it's just a quick scribble. Only, text-highlighting part was a good algorithmic challenge for me.
- JDK 1.8 - 1.8 on purpose since I have learnt that in Labforward, this is the current JDK version that is being used.
- Spring Boot - Used for faster bootstrapping.
- Maven - Despite Gradle was in Labforward's tech stack, I thought it may take some time for me to learn its internal details, I decided to use Maven.
- Apache Commons Text for text similarity calculation
- ModelMapper for entity-dto mappings
- Springfox Swagger UI for documentation
- React for easier UI development
- Material-UI for styling. I choosed Material-UI on purpose since it's in the tech stack of Labforward.
URL | Method | Remarks |
---|---|---|
/api/entries |
GET | Gets all entries |
/api/entries/{id} |
GET | Gets entry by id |
/api/entries |
POST | Creates new entry |
/api/entries/{id} |
PUT | Updates an entry |
/api/entries/{id} |
DELETE | Deletes an entry |
/api/entries/{id}/search/{word} |
GET | Searches a word and similar words in an entry |
- SwaggerUI - http://localhost:8080/swagger-ui/ - Documentation & Testing