replace rest api with homegrown (no framework), include tests