Book Image

RESTful Web API Design with Node.js

By : Valentin Bojinov
Book Image

RESTful Web API Design with Node.js

By: Valentin Bojinov

Overview of this book

<p>In this era of cloud computing, every data provisioning solution is built in a scalable and fail-safe way. Thus, when building RESTful services, the right choice of the underlying platform is vital. Node.js, with its asynchronous, event-driven architecture, is just the right choice to build RESTful APIs.</p> <p>This book will be your step-by-step guide in the RESTful world of Node.js. It starts with the implementation of a simple HTTP handler application and follows its evolution to a completed RESTful service solution, which introduces you to the best practices in developing RESTful services.</p>
Table of Contents (13 chapters)
RESTful Web API Design with Node.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Key/value store – LevelDB


The first data store we will look at is LevelDB. It is an open source implementation developed by Google and written in C++. It is supported by a wide range of platforms, including Node.js. LevelDB is a key/value store; both the key and value are represented as binary data, so their content can vary from simple strings to binary representations of serialized objects in any format, such as JSON or XML. As it is a key/value data store, working with it is similar to working with an associative array—a key identifies an object uniquely within the store. Furthermore, the keys are stored as sorted for better performance. But what makes LevelDB perform better than an arbitrary file storage implementation?

Well, it uses a "log-structured merge" topology, which stores all write operations in an in-memory log, transferred (flushed) regularly to a permanent storage called Sorted String Table (SST) files. Read operations first attempt to retrieve entries from a cache containing...