Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.end(JSON.stringify({ message: 'Hello, World!' }));
});
const UPDATE_WORLD = "UPDATE world SET randomnumber=$1 WHERE id=$2";
const SELECT_WORLD = "SELECT id, randomnumber from WORLD where id=$1";
const SELECT_FORTUNE = "SELECT id, message from FORTUNE";
let connectOptions = new PgConnectOptions()
.setCachePreparedStatements(true)
.setHost('tfb-database')
.setUser('benchmarkdbuser')
.setPassword('benchmarkdbpass')
.setDatabase('hello_world');
// Pool options
let poolOptions = new PoolOptions()
.setMaxSize(1);
// Create the client pool
let client = PgPool.pool(vertx, connectOptions, poolOptions);
/*
* This test exercises the framework's object-relational mapper (ORM), random number generator, database driver,
* and database connection pool.
*/
app.get("/db").handler(ctx => {
client.preparedQuery(SELECT_WORLD, Tuple.of(util.randomWorld()), res => {
if (res.succeeded()) {
let resultSet = res.result().iterator();
if (!resultSet.hasNext()) {
ctx.fail(404);