This application uses a .NET Core 8 API for the backend and an Angular 18 application for the frontend. The backend data is stored in a JSON file, and the application includes server-side pagination to handle large datasets efficiently.
This application has separate repositories for the back end and front end.
- Backend (API): [https://github.com/krutikshah24/CMS.API]
- Frontend (UI): [https://github.com/krutikshah24/CMS.UI]
Clone each repository separately and follow the setup instructions below for each project.
To set up this project, you must configure both the backend and frontend environments.
-
Install .NET SDK:
- Download and install the .NET SDK (version 8.0 or higher).
-
Restore Dependencies:
- In the backend project folder, run the following command to restore necessary NuGet packages:
dotnet restore
- In the backend project folder, run the following command to restore necessary NuGet packages:
-
Build the Project:
- To ensure all components are correctly built, run:
dotnet build
- To ensure all components are correctly built, run:
-
Install Node.js and Angular CLI:
- Download and install Node.js (LTS version recommended).
- Install the Angular CLI globally by running:
npm install -g @angular/cli
- Confirm the installation by running:
ng version
-
Navigate to the Angular Project Directory:
- Move into the
CMS.UI
directory where the Angular code is located.
- Move into the
-
Install Dependencies:
- Install the required npm packages by running:
npm install
- Install the required npm packages by running:
-
Navigate to the Backend Project Repository:
- Open a terminal and navigate to the backend project directory.
-
Start the API:
- Run the backend API with the following command:
dotnet run
- The API should now be accessible at
https://localhost:7130
. This endpoint serves as the base URL for all API requests.
- Run the backend API with the following command:
-
Navigate to the Angular Project Repository:
- Open a new terminal and navigate to the
CMS.UI
Repository.
- Open a new terminal and navigate to the
-
Start the Angular Application:
- Run the Angular frontend with the following command:
ng serve
- The application should now be accessible at
http://localhost:4200
. The Angular application will use the backend API to perform CRUD operations.
- Run the Angular frontend with the following command:
- Controllers: The
UserController
is the main API controller. It handles HTTP requests for CRUD operations and routes them to theUserService
. - Services: The
UserService
implements the main business logic, performing CRUD operations on the user data. It communicates with a repository layer for data access. - Models: The
User
model represents the data schema for users, defining the properties and validation rules (e.g., required fields and email format).
- Components:
UserListComponent
: Displays a list of users with pagination controls for easy navigation.UserFormComponent
: Handles user creation and update operations, with form validation for required fields and email format.
- Services:
UserService
: An Angular service that usesHttpClient
to send HTTP requests to the backend API, providing methods for CRUD operations.
- Models:
- A TypeScript interface defines the structure of the
User
model in the frontend, ensuring consistency with the backend data schema.
- A TypeScript interface defines the structure of the
- Pagination:
- The frontend requests data in pages from the backend, enabling server-side pagination for optimized data handling.