Server-Side Development

The Server-Side or just Server is the Computer that is hosting the Web-Application or website an End-User is accessing. The way I like to look at it is that the computer you are currently using would be a Server, which means it can host a Website that someone can use internally or remotely.

When users access your Website, they are normally sending requests through HTTP or HTTP/2 Protocol through the Web Browser to the Server-Side located somewhere else, which could be your Computer.

However, personal Computers were not made to operate as Production Servers, in major companies,
the Server Computers are grouped into one major Server called Cluster. See the image of the
Server rack Cabinet housing several Servers.

When the request comes into the Server, the Server-Side Framework (Asp.Net Core) then compiles
and sends the compressed HTML5, CSS3, Images, and JavaScript back to the Web Browser
through the HTTP/HTTP2 pipeline/channel to the user who requested the Website.

When developing the Application in Visual Studio, look at it as, the Web Browser you 
will be using to access the Application would be the User who is located remotely, sending
HTTP/HTTPS request to the Back-End Server, which is the C# Code.

Keep in mind that, when developing, most of the bottlenecks can not be experienced
by developers because the distance between the Web Browser and the Server-Side Code is short.
That is why it is important to do a stress test and try by all means to mimic
the User accessing the Web Application from far away. 

Optimizing the Server Response Time is very important. The response happens in a lightning time and it is crucial to capitalize on the speed your Server responds to users' requests. We will be looking in-depth into this topic in the near chapters.

We will be using C# as our server-side programming language in this book because it is easy to program and has readily accessible documentation.

[Note]: Learn more about C# Programming Language at:
C# has a very forgiving programming environment and is fully supported by Microsoft. There is a huge community on the internet just in case you experience problems with your code.  

[Tip]: One of the important things to understand when programming or making a website is never to give up researching and maintain patience.

Here's a step-by-step outline for creating the server side of a social media application using ASP.NET Core:

Step 1: Define Requirements and Data Models

  1. Clearly define the requirements of your social media application, including user authentication and authorization, posting and viewing posts, commenting, user profiles, and other relevant functionalities.

    [Tip]: Use an Open Source Diagram tool like to model your classes. Below is an example:
             below is an illustration of how you would map your own relationships between classes.


  2. Identify the data models that will represent the entities in your application, such as users, posts, comments, and other relevant data.

  3. Design the database schema and define the relationships between the data models.

Step 2: Set up ASP.NET Core Project

     4. Install the latest version of Visual Studio and ASP.NET Core SDK on
         your machine. This has been accomplished in the previous Chapter.

  1. Create a new ASP.NET Core project using the MVC template.
    - This has been accomplished in the previous Chapter.

Step 3: Implement Data Access Layer

     6. Use Entity Framework Core, which is the default ORM (Object-Relational Mapper)
         in ASP.NET Core,
to interact with your database and perform CRUD
         (Create, Read, Update, Delete) operations on your data models.


  1. Implement a data access layer using repositories or data services to abstract the interaction with the database from the rest of the application logic.

  2. Implement data validation and ensure data integrity by applying appropriate data annotations or Fluent API configurations.

Step 4: Implement Business Logic

    9. Implement business logic to handle the core functionalities of your social media application,
        such as user
authentication and authorization, posting and viewing posts, commenting,
        and other relevant functionalities.

  1. Use services or managers to encapsulate the business logic and keep it separated from the presentation layer.

  2. Implement business rules, validations, and other application logic to ensure the correctness and security of your application.

Step 5: Implement Controllers and Actions

   12. Create controllers that handle HTTP requests from clients and interact with the appropriate services
        or managers to perform the necessary business logic.

  1. Implement actions in your controllers to handle different HTTP verbs (GET, POST, PUT, DELETE) and route requests to the appropriate services or managers.

  2. Implement authentication and authorization using ASP.NET Core Identity or other authentication/authorization libraries to secure access to protected resources.

Step 6: Implement APIs

   15. If your social media application requires APIs to enable communication with clients, implement
         APIs using

  1. Define API endpoints and routes to expose the necessary functionalities of your social media application to clients.

  2. Implement authentication and authorization for your APIs to ensure secure access to the API resources.

Step 7: Test and Debug

   18. Test your server-side logic by manually verifying different scenarios, such as user
         authentication, posting
and viewing posts, commenting, and other functionalities.

  1. Use debugging tools, such as Visual Studio debugger or logging libraries, to identify and fix any errors or issues that may arise during testing.

  2. Perform unit testing and integration testing to ensure the correctness and robustness of your server-side logic.

Step 8: Optimize and Refactor

    21. Optimize your server-side code for performance, scalability, and security.

  1. Refactor your code to improve code quality, maintainability, and extensibility.

  2. Continuously update and improve your server-side logic based on user feedback and changing requirements.

This is a general outline for creating the server side of a social media application using ASP.NET Core. The actual implementation for many production-ready web applications may vary depending on your specific application requirements, chosen technologies, and design patterns.


Computer Programming

© 2024 - ErnesTech - Privacy
E-Commerce Return Policy