Skip to content

AlexYates/database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

database

Install a PouchDB-Server globally with PNPM pnpm install -g pouchdb-server, and run pouchdb-server --dir ./dist --port 5984 to spawn the database server.

Then, open http://localhost:5984/_utils/#/verifyinstall in a browser, to view the dashboard and verify the installation.

Add this line to your .gitignore file, to keep the database log files out of your repository.

# PouchDB
log.txt

Since we've installed PouchDB-Server, a CORS solution is already added by default. Otherwise, run pnpm install -g add-cors-to-couchdb to add CORS to your CouchDB server.

Next, run pnpm install pouchdb @types/pouchdb; note that we're including PouchDB @types since we'll be writing in Typescript. After those modules install, run tsc --init to create a tsconfig.json file. We'll need to set "allowSyntheticDefaultImports" to true, so default imports from modules without a default export work, and set the "outDir" to "./dist" to maintain seperation of source and distribution files.

{
  "compilerOptions": {
    "outDir": "./dist",
    ...
    "allowSyntheticDefaultImports": true
  }
}

In our dist sub-directory, we can create our index.ts, and write the following:

import * as PouchDB from 'pouchdb';

Change into the src directory and compile with tsc --build ../tsconfig.json --watch to generate the dist/index.js file and to continually watch for updates.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published