The front end of an academic digital library search interface built with Angular and Material UI components. It was developed to assess Dilex (another digital library search application) in a controlled laboratory test where this interface was the baseline condition used by half of the participants. The app consumes a node.js (express) REST API which uses Exlibris REST API for fetching search results and mongoDB atlas database for storing search queries, saved documents, and user data.
Search Page Features
Search, view, save/delete documents
Select and save/delete documents in batch
Assign labels to selected documents.
Save search query to workspace
Personal Workspace Features
History Tab: Browse, delete, and reissue search history in single or batch mode
Saved documents Tab: Browse, delete, view saved documents Select documents and assign new or existing labels Remove labels from documents Filter saved documents by labels
2. Backend
This is the REST API of an academic digital library search interface built with node.js and typescript. This API is consumed by an Angular app.
Features
Written in Typescript for typed DB models, controllers, services and other source files
JWT Authentication with access and refresh tokens. Here is the auth workflow:
The client initiates login
Access and refresh tokens are created
A refresh token is saved to DB and then both tokens are returned
The client sends access token with the header for subsequent requests
This access token is verified by the auth-middleware for each protected route
The client receives 401 if the access token expires and requests a new access token with the refresh token
After receiving the refresh-token it is verified and also assessed with the DB token
If the refresh token is valid new set pair of access and refresh tokens are generated and returned to the user
If the refresh token is invalid client initiates login again
Three-tier architecture used for separating different layers and easy code maintainability:
DB Layer: Database logics are written in repository files for each DB model
Business Layer: Business logics are written in service files
Presentation Layer: Joi Input validation, Error handling, and Proper custom HTTP response creation are done in routing and controller files
Workflow: Route -> Controller -> Service -> Repository
Best practices for RESTful API implemented:
Correct usage of HTTP methods (GET, POST, PUT, DELETE, PATCH, etc) \
Using plural nouns for segmenting routes
Proper HTTP status codes and consistent response messages are used to explain different types of errors and API response
Error Handling:
Async errors are handled by a wrapper middleware function which is called with each controller function.
Synchronous errors are handled by another middleware which converts the thrown errors into custom error responses based on types of the errors
Through the app, custom errors are thrown so that they can be caught and properly processed by the synchronous error handler middleware
JOI Validation: JOI validation schemas are written for validating incoming requests
Hot Reloading: Nodemon is used in the development mode for hot reloading.