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
/** | |
* All the assertion code below the line could be replaced with | |
* this single line by using env-var | |
*/ | |
env.get(MAX_BATCH_SIZE).required().asIntPositive() | |
// ----------------------------------------------- | |
const assert = require('assert'); |
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
const env = require('env-var'); | |
const MAX_BATCH_SIZE = env.get('MAX_BATCH_SIZE').required().asIntPositive(); |
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
oc new-project quarkus-project --display-name="Quarkus Project" | |
oc new-build quay.io/redhat/ubi-quarkus-native-runner --binary --name=quarkus-quickstart -l app=quarkus-quickstart | |
# Replace filename with whatever your file is called, e.g quarkus-quickstart-1.0-SNAPSHOT-runner | |
# This command might report a file copy error - my build still worked despite this 👍 | |
oc start-build quarkus-quickstart --from-file=target/$FILENAME-runner --follow | |
oc new-app quarkus-quickstart | |
oc expose service quarkus-quickstart |
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
const fastify = require('fastify')({ | |
logger: false | |
}) | |
// Declare a route | |
fastify.get('/hello', (request, reply) => { | |
reply.send('hello') | |
}) | |
// Run the server! |
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
/** | |
* Quick setup: | |
* | |
* $ mkdir /tmp/wss | |
* $ cd /tmp/wss | |
* $ npm init -f | |
* $ curl https://gist.githubusercontent.com/evanshortiss/83e63dc9cab83c7e7aba6780da3704bd/raw/ae5d532a371ef383d896f1663a454102cc1931c3/wss.js > wss.js | |
* $ node wss.js | |
*/ |
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
const supertest = require('supertest') | |
const express = require('express') | |
const router = require('lib/routes/some-router') | |
describe('#some-router tests', () => { | |
// temp express app. allows to tests routes in isolation from broader application | |
const app = express() | |
// app.use(router()) or whatever way works for your structure | |
app.use('/stuff', router) |
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
# | |
# This is the main Apache HTTP server configuration file. It contains the | |
# configuration directives that give the server its instructions. | |
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information. | |
# In particular, see | |
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html> | |
# for a discussion of each configuration directive. | |
# | |
# Do NOT simply read the instructions in here without understanding | |
# what they do. They're here only as hints or reminders. If you are unsure |
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
// If you're working with a local domain you can uncomment this | |
// or update your fhconfig.json according to the RHMAP local | |
// development guides | |
// $fh.getCloudUrl = function () { | |
// return 'https://nodejs-cloudappdevezqll-rhmap-rhmap-development.127.0.0.1.nip.io' | |
//} | |
// Let the code below initialise, then configure our UI | |
setTimeout(function () { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | |
<title>Hello World</title> | |
<link rel="stylesheet" href="css/app.css"> | |
</head> | |
<body> |
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
const sync = require('fh-mbaas-api').sync | |
const workorders = require('lib/sql/workorders') | |
// Typical init code etc... | |
// Example of getting work orders for a specific user | |
sync.handleList('workorders', function(datasetId, query, metadata, done) { | |
// Getting by the userId passed to the sync framework and the region they are in | |
workorders.getDataForUserInRegion(query.userId, query.region, (err, specificUserWorkOrders) => { | |
if (err) { |