Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
Last active April 2, 2023 19:44
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nolanlawson/bddac54b92c2d8d39241 to your computer and use it in GitHub Desktop.
Save nolanlawson/bddac54b92c2d8d39241 to your computer and use it in GitHub Desktop.
Creating a database
<html>
<body>
<pre id="display"></pre>
<script src="//cdn.jsdelivr.net/pouchdb/latest/pouchdb.min.js"></script>
<script src="index.js"></script>
</body>
</html>
var db = new PouchDB('sample');
db.info().then(function (info) {
document.getElementById('display').innerHTML = 'We have a database: ' + JSON.stringify(info);
});
@suewonjp
Copy link

I suggest JSON.stringify(info, null, 2) for prettier JSON look.

And you can quickly launch a simple http web server to test the code using Node.js http-server package

### install (sudo might be necessary)
npm install -g http-server

### help for the http-server
hs -h

### launch
hs -a localhost -p 8000 -c-1 ./

Now access the page http://localhost:8000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment