This post is part of a Series of post which I’m describing a clock-in/out system
if you want to read more you can read the following posts:
- Part 1. Clock-in/out System: Diagram.
- Part 2. Clock-in/out System: Basic backend — AuthModule.
- Part 3. Clock-in/out System: Basic backend — UsersModule.
- Part 4. Clock-in/out System: Basic backend- AppModule.
- Part 5. Clock-in/out System: Seed Database and migration data
- Part 6. Clock-in/out System: Basic frontend.
- Part 7. Clock-in/out System: Deploy backend (nestJS) using docker/docker-compose.
- Part 8. Clock-in/out System: Deploy frontend (Angular 2+) using environments.
- Part 9. Testing: Backend Testing — Unit Testing - Services
- Part 10. Testing: Backend Testing — Unit Testing - Controllers
- Part 11. Testing: Backend Testing — E2E Testing
- Part 12. Testing: Frontend Testing — Unit Testing
- Part 13. Testing: Frontend Testing — Integration Testing
In the previous post, I presented the module UserModule which is used to manage
the information about the user. So, I recommend you that you read the first post
before this because you can understand the whole system.
This post will presented the AppModule which is used to manage the request
of the user from an Angular frontend. This module only have a service,
controller and module. The AppService inject the two services: UserService
and AuthService from the modules UsersModule and AuthModule. This
service is used as a wrapper which use both services.
So, the first step is show the AppModule code:
You can see that this module imports AuthModule and UsersModule which is
very important because the AppService injected AuthService and
So, the next step is develop the controller which contains two routes associated
to clock-in and clock-out which invoke the AppService (which will invoke
AuthService) and one route associate to get the list of users which must be
working now and the timestamp from the server (to get near-realtime which will
So, the final step is develop the AppService which uses the two previously
In this post I’ve explain my AppModule which is very simple because I’m using
clean code in my coding. This module is used to communicate client-side
(Angular) and server-side. This module import AuthModule and UsersModule which
exports their services. These services are used to save the information about
the clock-in/out and get all users which must be working.
At the moment, we’ve developed a basic backend with three modules and different
endpoints. In the following post about backend, we will explain about the seed
of the database and testing. However, in the following post of this series we
will explain how to build a basic frontend using Angular and RxJS.
Originally published at www.carloscaballero.io on December 14, 2018.