Вот мой код примитивного сервера:
import http.server
import socketserver
PORT = 8080
Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("serving at port", PORT)
httpd.serve_forever()
как подключить к нему json файл так, что бы доступ к данным был не по http://localhost:8080/db.json, а по http://localhost:8080/data
json файл:
{
"data": {
"barcode": "1234587867678",
"weight": "3",
"volume": "0.9",
"length_": "8",
"width": "2",
"height": "9",
"uniqueIndex": "555"
}
}