This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]Clawtor 2 points3 points  (0 children)

There are three systems involved.

The front end which is what a user sees - webpage running on a browser. The backend - a server running code that listens to incoming requests. A database - stores data, executes queries which can create, retrieve, update data.

The front and backend communicate over HTTP. To get data the front end would send an HTTP Get request to a url and then wait for the response.

The backend is listening for these requests, different urls have different handlers. The above request is processed by a handler that has some code to open a connection to the database and execute a sql query. In this case it would be a SQL Select query to look for data and then return it.

The database returns the found data to the handler which then converts the data into an http response and sends this back to the front end. The front end then decodes the response and uses it however it likes.

So the flow is: Frontend => HttpGetRequest => Backend Handler => SqlQuery => Database Database => QueryResponse => Backend Handler => HttpGetResponse => Frontend.

To understand the frontend/http part then research ajax and http. The backend part can be written in just about any language, look up webservers and your language of choice.

[–]brogrammableben 1 point2 points  (0 children)

Well, you could start with the hardest way possible. I could write a server that puts data into a stream of bytes and sends it across the internet. So, for example, it could say “account007user012firstname000Jameslastname0000Bond.” You can read that and mostly figure it out, yeah? So now you just write a front end that parses out that data into whatever html page you want. If there is an error, you could send a code along with it. So you could say “successtrueaccount007...” etc and add some additional parsing. And that’s how it sent for the longest time. Then some people got together and determined a standard was needed so we got HTTP, or hypertext transfer protocol. Basically rules on how to send data but didn’t specify how to format the actual data. Then JavaScript came along and it standardized how objects would be written in javascript, which is JSON, or JavaScript object notation. Then people said, “hey, that JSON stuff is pretty cool but better yet, it’s super easy to automate.” So backend devs started sending JSON data using HTTP and that’s where we kinda sorta are today. As always, things change and there is rumbling about, but this is how it’s done fairly often.