switch server to cowboy, implement basic rest api, add message model