This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use script' | |
var pdfmake = require('pdfmake'); | |
const express = require('express') | |
const app = express() | |
app.get('/generate-pdf', (req, res) => { | |
const doc = new pdfmake({ | |
Roboto: { normal: new Buffer(require('pdfmake/build/vfs_fonts.js').pdfMake.vfs['Roboto-Regular.ttf'], 'base64') } | |
}).createPdfKitDocument({ content: 'test' }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use script' | |
var pdfmake = require('pdfmake'); | |
var fs = require('fs'); | |
const doc = new pdfmake({ | |
Roboto: { normal: new Buffer(require('pdfmake/build/vfs_fonts.js').pdfMake.vfs['Roboto-Regular.ttf'], 'base64') } | |
}).createPdfKitDocument({ content: 'test' }) | |
doc.pipe(fs.createWriteStream('myFile.pdf')) | |
doc.end() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Discovers a table schema and outputs it into a file: run this script via: | |
* $ node discover-schema.js | |
*/ | |
var path = require('path'); | |
var fs = require('fs'); | |
var app = require('loopback'); | |
var output_directory = path.resolve(__dirname, '..', '..', 'common', 'models'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const { Pool } = require('pg') | |
// create a pool instance. | |
// Refer to https://node-postgres.com/api/pool for more info on how to config pool | |
var pool = new Pool({ | |
"host": "YOUR_HOST", | |
"port": YOURPORT, | |
"database": "DBNAME", | |
"user": "USERNAME", |