New JavaScript library makes prototyping easy
The JavaScript-based Kakapo.js HTTP mocking library enables developers to replicate back-end logic in a declarative manner in the browser. Thus, apps can be prototyped and developed without the back end, and developers can deactivate Kakapo when moving to production.
Kakapo is currently in beta, although it's in use in a couple of applications where code coverage is 97 percent, said Hector Zarco, the main developer of Kakapo.
"I basically built Kakapo because I wanted to have a framework that provides all the tools I need to prototype Web apps without having to wait [for] the back end to be ready," Zarco said. "Also, with Kakapo.js you can build reliable and consistent mocks just in the browser, without having to set up an http server that returns the fake data."
Kakapo features routing, response, request, and database capabilities, but the key feature, Zarco said, is an ability to build advanced uses cases. "Let's say you have a blog and you want to comment, and later during the app lifecycle you want to retrieve that comment. You can easily build that with Kakapo, instead of just returning static payloads without any sense all the time."
Kakapo, which is the name of a bird in New Zealand, uses WeakMap, a collection of key/value pairs in JavaScript, with keys weakly referenced. "We had to use it instead of simple hashes because we wanted to use objects as keys instead of plain values like strings," said Zarco REST, meanwhile, is used to build back end APIs.
Currently limited to Web development, a version of Kakapo also is being readied for Apple's Swift language, and Node.js compatibility is in the works as well.