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
// import dependencies from npm | |
const Fastify = require('fastify'); | |
const path = require('path'); | |
const AutoLoad = require('fastify-autoload'); | |
const uuidv4 = require('uuid/v4'); | |
// create request ids | |
const createRequestId = () => uuidv4(); | |
// create 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
{ | |
"logSeverity": "info" | |
} |
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 nconf = require('nconf'); | |
const _ = require('lodash'); | |
const loadSettings = ({ appSettingsPath }) => new Promise((resolve, reject) => { | |
try { | |
if (_.isEmpty(appSettingsPath)) { | |
throw new Error('Configuration settings path is required.'); | |
} | |
nconf.file({ | |
file: appSettingsPath, |
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 nconf = require('nconf'); | |
const server = require('./server'); | |
const { loadSettings } = require('./config/configurationAdaptor'); | |
const appSettingsPath = process.env.APP_SETTINGS_FILE_PATH; | |
loadSettings({ appSettingsPath }) | |
.then(() => { | |
// TODO Connect to DB, if any. |
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
// import dependencies from npm | |
const Fastify = require('fastify'); | |
const path = require('path'); | |
const AutoLoad = require('fastify-autoload'); | |
const uuidv4 = require('uuid/v4'); | |
// create request ids | |
const createRequestId = () => uuidv4(); | |
const createServer = (options) => { |
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
{ | |
"logSeverity": "info", | |
"app": { | |
"isEmailVerificationEnabled": false, | |
"emailTokenExpiryInSeconds": "7d", | |
"userPasswordRegex" : "^(?=.{6,})", | |
"userJwtExpiry" : "2d" | |
}, | |
"url" : { | |
"self": "", |
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
// api/routes/root.js | |
module.exports = async function (fastify, opts) { | |
fastify.get('/', async function (request, reply) { | |
return { hello: "World" } | |
}) | |
} |
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
// import dependencies from npm | |
const Fastify = require('fastify'); | |
const path = require('path'); | |
const AutoLoad = require('fastify-autoload'); | |
const uuidv4 = require('uuid/v4'); | |
// create request ids | |
const createRequestId = () => uuidv4(); | |
const createServer = (options) => { |
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 IntelliSense to learn about possible attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Launch Program", |
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 request = require('request-promise-native'); | |
const nconf = require('nconf'); | |
const externalAPITimeout = nconf.get('app.externalAPITimeout'); | |
const getRequest = ({url, options}) => request.get(url, {...options, timeout: externalAPITimeout, json:true}); | |
module.exports = { | |
getRequest | |
} |
OlderNewer