refactor server
add database conn