Question

  • Creator
    Topic
  • #4019543
    Avatar photo

    Server Side of Website

    Locked

    by Iustinian Serban ·

    Hello.
    I am a bachelor’s student in Automation and Computer Science.
    I want to create an eCommerce site from scratch using a three-way architecture. I don’t have any questions regarding the HTML or the Database, just about the Server (I’m going to pay for hosting). I created a RestAPI using Spring, Java, and MySQL in the past, so I have some experience (Javascript sends the input to the server, and the server fetches data from my database and sends it back to my website).
    I want to know how I can connect my Website and my Database, and how to fetch the correct data. Where do I put my logic code?

    I would appreciate your response to this.

All Answers

  • Author
    Replies
    • #4019664
      Avatar photo

      Re: Server side of website

      by kees_b ·

      In reply to Server Side of Website

      The client (the program running in your browser) sends a get or put-request to the server.
      The program running on the server connects to the database and runs the necessary SQL-statements via the database API.

      https://www.w3schools.com/php/php_mysql_connect.asp tells how it works in PHP 5. But you might be using another language at the server site.

      Two remarks:
      1. Isn’t this treated in the course material?
      2. Why not run the server on your own PC in localhost? You don’t have to pay for hosting then and it’s a very useful experience for an IT bachelor.

      • #4019771
        Avatar photo

        Reply To: Server Side of Website

        by Iustinian Serban ·

        In reply to Re: Server side of website

        Thank you for your answer.
        So if I want to create a RestAPI as a Spring Boot Application and host it on a server, would it run like a normal website?
        1. Currently, I’m in my first year of University. They teach us this type of course in the second or third year. This website is a personal project.
        2. I was thinking about that. I will run it on my PC in the early stages, but I want to take the site public when it’s finished.

        • #4020150
          Avatar photo

          Re: API

          by kees_b ·

          In reply to Reply To: Server Side of Website

          Strictly speaking, an API is an interface. Interfaces don’t run. They are being called.
          Websites don’t run either, The webserver runs.

          Best of luck with your project.

    • #4026404

      Reply To: Server Side of Website

      by auraitsollutions ·

      In reply to Server Side of Website

      The server-side code handles tasks like validating submitted data and requests, using databases to store and retrieve data and sending the correct data to the client as required.

      • This reply was modified 1 year, 12 months ago by auraitsollutions.
      • This reply was modified 1 year, 7 months ago by Avatar photokees_b.
    • #4053331

      Reply To: Server Side of Website

      by km.naqvie14 ·

      In reply to Server Side of Website

      Hello, as you already have experience with creating a REST API using Spring, Java, and MySQL, connecting your website to the database should be relatively straightforward.

      To connect your website to your database, you will need to create a server-side application that will handle requests from the website and interact with the database to retrieve or update data.

      You can use Spring to create this server-side application. In the application, you will need to create a data access layer that will handle interactions with the database. This layer should include classes that will connect to the database, execute queries, and return data.

      Your logic code should be placed in the appropriate controller classes in the server-side application. These controllers will handle incoming requests from the website, retrieve data from the database using the data access layer, and return the appropriate data to the website in the form of a REST API response.

      • This reply was modified 1 year, 7 months ago by Avatar photokees_b.
    • #4095399

      SSR (SERVER SIDE RENDERING)

      by lucasgarciabertaina ·

      In reply to Server Side of Website

      Unfortunately, you haven’t made an SSR web app without using Javascript.

      If you are new in this area, I recommend you to make the basic frontend courses of FreeCodeCamp and after that start to look up a javascript framework called React.

      There are many other options, like angular, svelt, and vue. But I think react is a good option in your context.

    • #4117650

      Reply To: Server Side of Website

      by primepage123 ·

      In reply to Server Side of Website

      In most of the applications, backend APIs will be acted as a mediator to communicate with the clients through the web server.

      You can write all the business logic in the APIs itself and use them to showcase the information on the frontend.

      You can also go for any no code services like GraphQL to create APIs quickly and use them.

      • This reply was modified 1 year, 7 months ago by primepage123.
      • This reply was modified 1 year, 7 months ago by Avatar photokees_b.
Viewing 4 reply threads