Converted server from node to flask