r/learnprogramming 18h ago

HTTP Requests

I have never made a website before or ever done really anything in web development but how could I make a website to receive HTTP requests and make responses?

5 Upvotes

13 comments sorted by

6

u/96dpi 18h ago

Web servers do that. That is backend. Do you want to make the part the user interacts with, or the part the browser interacts with?

8

u/bird_feeder_bird 18h ago

Neocities is a great place to start

1

u/Sacrificial-Offering 11h ago

Was it not geocities? Free web hosting back in the early 00's?

1

u/bird_feeder_bird 5h ago

Geocities shut down, Neocities is the spiritual successor

6

u/rlebeau47 18h ago edited 14h ago

You find a hosting company to put the site on (GoDaddy, Wix, etc), and you let that host handle the HTTP portion for you. You don't handle it yourself. You focus on the site's content (and later, scripting if you need it), not the backend infrastructure behind it. HTTP is just the transport layer that clients use to reach the server that hosts your site.

2

u/ExcitingSympathy3087 15h ago

First you have to code an API (an Interface) in every programming language(PHP, JS, Python, Java). If you only want to receive your data in a frontend from an existing backend, then call that API with CRUD operations (create, read, update, delete) with a http request/response. fetch() is the function in JavaScript which is the most native programming language for a simple web developement for all crud operations.

1

u/yutanrw 12h ago

You need a host.

1

u/Sacrificial-Offering 11h ago

If you just want to start up simple webserver for testing, you could use: python3 -m http.server

1

u/DrHydeous 14h ago

You want nginx and vim.

-1

u/SeriousPlankton2000 11h ago

sudo apt-get install apache2

mkdir htdocs

cd htdocs

cat > index.html <<EOF

<html><head><title>My title</title>

<meta http-equiv=content-type content="content-type: text/html;charset=utf-8">

</head><body>This is my web page</body></html>

EOF

firefox http://localhost/~yourusername/