It is modeled after CouchDB – a NoSQL database that powers npm. We can also create applications using PouchDB which can work offline and online and thus it saves data locally. PouchDB uses IndexedDB and WebSQL internally for data storage.
How PouchDB work offline ?
PouchDB works offline as well as online with the same efficiency. It works offline by storing the data locally and synchronizing it to the servers and CouchDB when online. It stores data locally using IndexedDB and WebSQL in the browser.
You can also communicate with remote and local databases continuously using PouchDB without noticing any difference.
Features of PouchDB :
- Open Source –
It is available on GitHub and on other open source application.
- Cross-Browser –
We can run PouchDB on various browsers as the API provided by it works the same in every environment.
- Easy to learn and understand –
If you have some knowledge of programming language, PouchDB is very easy to learn and understand.
- Lightweight –
We can easily include it using script tag as it has a light weight API.
Advantages of PouchDB :
- There is no need to perform queries over network as PouchDB resides inside the browser and thus it makes it extremely faster.
- You can run apps both online and offline as you can synchronize the data with any of the supported server.
Installing PouchDB :
2.Install PouchDB – Execute the following code on command prompt to install PouchDB.
npm install pouchdb
3.Install PouchDB Server – Execute the following code on command prompt to install PouchDB Server.
npm install -g pouchdb-server
4.Set a local Port number – Now set a port to run PouchDB:
pouchdb-server -p 5984
After this, let the pointer keep on blinking.
5.Open PouchDB – Now visit the following address.
Now, your PouchDB installation is successful.