loading...
Cover image for Part 4. Clock-in/out System - Basic backend (III) - AppModule

Part 4. Clock-in/out System - Basic backend (III) - AppModule

carlillo profile image Carlos Caballero Updated on ・3 min read

clock-in/out system (10 Part Series)

1) Part 1. Clock-in/out System - Diagram 2) Part 2. Clock-in/out System: Basic backend (I) — AuthModule 3 ... 8 3) Part 3. Clock-in/out System - Basic backend (II) - UsersModule 4) Part 4. Clock-in/out System - Basic backend (III) - AppModule 5) Part 5. Clock-in/out System: Seed Database and migration data 6) Part 6. Clock-in/out System: Basic frontend - Angular 7) Part 7. Deploy Backend (NestJS): Docker/Docker-Compose 8) Part 8. Clock-in/out System: Deploy frontend (Angular 6+) using environments 9) Part 9. Clock-in/out System: Testing: Backend Testing 10) Part 10. Testing: Backend Testing — Unit Testing — Controllers

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:

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
UsersService.

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
invoke UserService).

So, the final step is develop the AppService which uses the two previously
mentioned services.

Resume

‌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.

clock-in/out system (10 Part Series)

1) Part 1. Clock-in/out System - Diagram 2) Part 2. Clock-in/out System: Basic backend (I) — AuthModule 3 ... 8 3) Part 3. Clock-in/out System - Basic backend (II) - UsersModule 4) Part 4. Clock-in/out System - Basic backend (III) - AppModule 5) Part 5. Clock-in/out System: Seed Database and migration data 6) Part 6. Clock-in/out System: Basic frontend - Angular 7) Part 7. Deploy Backend (NestJS): Docker/Docker-Compose 8) Part 8. Clock-in/out System: Deploy frontend (Angular 6+) using environments 9) Part 9. Clock-in/out System: Testing: Backend Testing 10) Part 10. Testing: Backend Testing — Unit Testing — Controllers

Posted on by:

carlillo profile

Carlos Caballero

@carlillo

I'm PhD. in Computer Science from Málaga, Spain. Currently, I am teaching developers and degree/master computer science how to be experts in web technologies and computer science.

Discussion

markdown guide