Browse Source

adds documentation on CGIs

apoc 5 months ago
1 changed files with 27 additions and 0 deletions
  1. 27
      docs/Series/4. http, servers/4.4 Common gateway

+ 27
- 0
docs/Series/4. http, servers/4.4 Common gateway View File

@@ -0,0 +1,27 @@
So far you have

- setup XAMPP
- read up on
1. Web servers, browsers,
2. the HTTP
3. and URIs

Now we are at the point where programming comes into play - a web browser loading a "web app", a program, if you will.

Remember how we went over programs (in document 1.1) and applications (in document 1.3)? This is now transferrable to web apps. If you re-visit 1.3 you will find documented very basic usage of the "dir" program, whose purpose is to list out state of the filesystem (see documents 3.1, 3.2) at location which it is invoked from.

Well, this same functionality can be turned into a web app, an HTTP networked program. You could, if you wanted to, tell Apache (in your XAMPP installation) to run "dir" every time it gets an HTTP request.

You could, if you wanted to, write a C++ "hello world" program

#include <iostream>

int main()
std::cout << "Hello world!";
return 0;

then point your XAMPP apache to the compiled binary/runtime so once you load http://localhost in a browser you will see a page saying "Hello world!". Now you get how web development basically works: write a program/script, then point a web server to get said program's output.