changed data to detail to be in route, detail view now works, and added an insert statement to create data if there is none.