How to use mariadb - 8 common examples

To help you get started, we’ve selected a few mariadb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github confluentinc / training-ksql-and-streams-src / solution / m-03 / ksql-etl / dashboard-app / server.js View on Github external
const express = require('express');
const mariadb = require('mariadb');
const mustacheExpress = require('mustache-express');

const app = express();
app.engine('html', mustacheExpress());
app.set('view engine', 'html');
app.set('views', __dirname + '/public');
app.use(express.static('public'));

const pool = mariadb.createPool({
    // host: 'localhost', 
    host: 'dashboard-db', 
    user:'dashboard', 
    password: 'dashboard123',
    database: 'MyDashboard'
});

app.listen(3000, host='0.0.0.0', ()=>{
    console.log("Dashboard App started...");
    console.log("Listening at port 3000...");
})

app.get("/dashboard", async (req,res)=>{
    res.render("dashboard");
})
github SaifRehman / ICP-Airways / icp-backend / booking-microservice / src / App.ts View on Github external
constructor() {
    this.jwtOptions.jwtFromRequest = this.ExtractJwt.fromAuthHeaderAsBearerToken();
    this.jwtOptions.secretOrKey = process.env.SECRET;
    this.connectionString = {
      host: process.env.HOSTNAMEMARIADB,
      user: process.env.UIDMARIADB,
      password: process.env.PASSWORDMARIADB,
      database: process.env.DATABASEMARIADB,
      connectionLimit: 5,
      port: process.env.PORTMARIADB
    };
    this.pool = mariadb.createPool(this.connectionString);
    console.log(this.connectionString);
    this.express = express();
    epimetheus.instrument(this.express);
    this.middleware();
    this.routes();
  }
  private ensureToken(req, res, next) {
github KhalisFoundation / banidb-api / api / controllers / amritkeertan.js View on Github external
const { createPool } = require('mariadb');
const config = require('../config');
const lib = require('../lib');

const pool = createPool(config.mysql);

const allColumns = `
aki.IndexID,
aki.HeaderID,
aki.ShabadID,
v.VerseID,
v.Gurmukhi,
v.Visraam,
v.GurmukhiUni,
v.Translations,
v.PageNo AS PageNo,
v.LineNo,
v.SourceID,
v.Transliterations,
v.WriterID,
w.WriterEnglish,
github KhalisFoundation / banidb-api / api / controllers / rehats.js View on Github external
const { createPool } = require('mariadb');
const config = require('../config');
const lib = require('../lib');

const pool = createPool(config.mysql);

exports.all = async (req, res) => {
  let conn;

  try {
    conn = await pool.getConnection();
    const q = 'SELECT id as rehatID, maryada_name as rehatName, alphabet FROM maryadas';
    const maryadas = await conn.query(q, []);
    res.json({
      count: maryadas.length,
      maryadas,
    });
  } catch (err) {
    lib.error(err, res, 500);
  } finally {
    if (conn) conn.end();
github paularmstrong / build-tracker / plugins / with-mariadb / src / index.ts View on Github external
export default function withMariadb(config: Omit & { mariadb: PoolConfig }): ServerConfig {
  const { mariadb: mariaConfig } = config;
  const database = mariaConfig.database || process.env.MARIADATABASE || 'buildtracker';

  const pool = createPool({
    user: process.env.MARIAUSER,
    host: process.env.MARIAHOST,
    password: process.env.MARIAPASSWORD,
    port: process.env.MARIAPORT ? parseInt(process.env.MARIAPORT, 10) : 3306,
    ...mariaConfig,
    database
  });

  const queries = new Queries(pool);

  return {
    ...config,
    setup: setup(pool),
    queries: {
      build: {
        byRevision: queries.getByRevision,
github KhalisFoundation / banidb-api / api / controllers / healthcheck.js View on Github external
exports.db = async (req, res) => {
  let conn;
  try {
    const pool = createPool({ ...config.mysql, connectTimeout: 3000 });
    conn = await pool.getConnection();
    const q = `SELECT 1 as ok FROM Verse WHERE ID=1 LIMIT 1`;
    const rows = await conn.query(q);
    rows[0].ok = rows[0].ok === 1;
    res.json(rows[0]);
  } catch (err) {
    lib.error(err, res, 500, false);
  } finally {
    if (conn) {
      conn.end();
    }
  }
};
github KhalisFoundation / banidb-api / api / controllers / banis.js View on Github external
const { createPool } = require('mariadb');
const config = require('../config');
const lib = require('../lib');

const lengthExistsMap = {
  s: 'existsSGPC',
  m: 'existsMedium',
  t: 'existsTaksal',
  b: 'existsBuddhaDal',
};

const pool = createPool(config.mysql);

const allColumns = `
b.Gurmukhi AS NameGurmukhi,
b.GurmukhiUni AS NameGurmukhiUni,
b.Transliterations AS NameTransliterations,
v.ID,
v.Gurmukhi,
v.Visraam,
v.GurmukhiUni,
v.Translations,
v.PageNo AS PageNo,
v.LineNo,
v.SourceID,
v.Transliterations,
v.WriterID,
w.WriterEnglish,
github KhalisFoundation / banidb-api / api / controllers / shabads.js View on Github external
const { createPool } = require('mariadb');
const banidb = require('@sttm/banidb');
const anvaad = require('anvaad-js');
const config = require('../config');
const lib = require('../lib');

const sources = banidb.SOURCES;
const searchTypes = banidb.TYPES;

const pool = createPool(config.mysql);

const allColumns = `v.ID, v.Gurmukhi, v.GurmukhiUni, v.Translations, v.PageNo AS PageNo, v.LineNo,
    v.SourceID as SourceID, s.ShabadID, v.FirstLetterStr, v.MainLetters, v.Visraam,
    v.FirstLetterEng, v.Transliterations, v.WriterID, w.WriterEnglish,
    w.WriterGurmukhi, w.WriterUnicode, v.RaagID, r.RaagGurmukhi,
    r.RaagUnicode, r.RaagEnglish, r.RaagWithPage, r.StartID, r.EndID,
    src.SourceGurmukhi, src.SourceUnicode, src.SourceEnglish,
    GREATEST(s.Updated, v.Updated) AS Updated`;

const liveColumns = `v.ID, v.Gurmukhi, v.GurmukhiUni, v.Translations, s.ShabadID`;

const allFrom = `FROM Verse v
  LEFT JOIN Shabad s ON s.VerseID = v.ID
  LEFT JOIN Writer w USING(WriterID)
  LEFT JOIN Raag r USING(RaagID)
  LEFT JOIN Source src USING(SourceID)`;

mariadb

fast mariadb or mysql connector.

LGPL-2.1
Latest version published 27 days ago

Package Health Score

87 / 100
Full package analysis

Popular mariadb functions