JSPM

  • Created
  • Published
  • Downloads 189238
  • Score
    100M100P100Q173639F
  • License MIT

SQLite client for Node.js applications

Package Exports

  • sqlite

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sqlite) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

SQLite client library for Node.js applications

NPM version NPM downloads Build Status Dependency Status IRC Chat

This is just a wrapper library that adds ES6 promises to sqlite3 (docs).

Prerequisites

  • Node.js v5 or higher
  • Babel JavaScript compiler (optional, but highly recommended)

Usage Sample

import express from 'express';
import Promise from 'bluebird';
import db from 'sqlite';

const server = express();
const port = process.env.PORT || 3000;

server.get('/', async (req, res, next) => {
  try {
    const row = await db.get(`SELECT * FROM tableName WHERE id = ?`, 123);
    res.send(`Hello, ${row.columnName}!`);
  } catch (err) {
    next(err);
  }
});

db.open('./db.sqlite', { verbose: true, Promise })
  .catch(err => console.error(err))
  .finally(() => {
    server.listen(port, () => {
      console.log(`Node.js app is running at http://localhost:${port}/`);
    });
  });

License

The MIT License © 2015 Kriasoft, LLC. All rights reserved.


Made with ♥ by Konstantin Tarkus (@koistya)