maxresdefaultjs100666172orig

New JavaScript library makes prototyping easy

JavaScript is getting mocked, but in a good way.

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.

IDG Insider

PREVIOUS ARTICLE

« WWDC 2016: Across its OSes, Apple evolves and integrates

NEXT ARTICLE

These are the top 5 productivity improvements from Apple's WWDC »
author_image
IDG News Service

The IDG News Service is the world's leading daily source of global IT news, commentary and editorial resources. The News Service distributes content to IDG's more than 300 IT publications in more than 60 countries.

  • Mail

Recommended for You

International Women's Day: We've come a long way, but there's still an awfully long way to go

Charlotte Trueman takes a diverse look at today’s tech landscape.

Trump's trade war and the FANG bubble: Good news for Latin America?

Lewis Page gets down to business across global tech

20 Red-Hot, Pre-IPO companies to watch in 2019 B2B tech - Part 1

Martin Veitch's inside track on today’s tech trends

Poll

Do you think your smartphone is making you a workaholic?