Reputation: 21
I'm trying to make a program. This program will have the functionality to host a file in an HTTP server but I couldn't find a way to make it.
This HTTP server will host a JSON file in it.
And I wanted to make a program that sends a request to that server and then reads everything inside that server directory.
I tried many attempts and messed around with Python but I can't find the correct way to make it
Upvotes: 2
Views: 251
Reputation: 11080
This is already included in the standard library. Just run this in your terminal from the directory you want to serve:
python -m http.server
This is not recommended for product use, however, if you need to run this in production it is better to use a real HTTP server like Apache or NGINX anway.
Upvotes: 1