This file contains 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 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 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 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 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 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 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 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) { |
This file contains 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' | |
// Ensure you run "npm install env-var@3 --save" | |
const env = require('env-var') | |
// Used to bypass check when running locally | |
const isLocal = env.get('FH_USE_LOCAL_DB').asBool() | |
// Valid mbaas IP(s) that can be in the "x-forwarded-for" header | |
// This must be set or app will not start (required() call) and must be comma separated |
This file contains 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 express = require('express') | |
const cors = require('cors') | |
const app = express() | |
// Enable CORS for all requests | |
app.use(cors()) |