TLDR: Use for...of instead of forEach() in asynchronous code.
For legacy browsers, use for(...;...;...) or [].reduce()
To execute the promises in parallel, use Promise.all([].map(...))
| /** | |
| * Validates request body using a set of rules | |
| * @param req Request body, req.body | |
| * @param rules Array of required fields | |
| * @return {{body: {}, errors: string}} Required fields and errors | |
| * @example | |
| const { body, errors } = ValidateRequest(req.body, [ | |
| 'username', | |
| 'last_name', | |
| 'email', | 
| type errors = { | |
| email: string, | |
| password: string, | |
| name?: string | |
| } | |
| /** | |
| * Formats errors as human readable json | |
| * @param error Error object or empty object incase of incorrect password | |
| * @param incorrectEmail boolean | 
| <template> | |
| <v-app style="background: #e2e8eb;"> | |
| <v-container> | |
| <v-row justify="center"> | |
| <v-col cols="12" md="5"> | |
| <v-container> | |
| <v-card class="ma-5 pa-5" color="#e2e8eb"> | |
| <v-card-title> | |
| <h1>Login</h1> | 
| # Build | |
| FROM node:alpine | |
| WORKDIR /myReactApp | |
| COPY package.json ./ | |
| RUN npm install | |
| COPY . ./ | |
| RUN npm run-script build | |
| # Serve | |
| FROM nginx:alpine | 
| const winston = require('winston'); | |
| const MESSAGE = Symbol.for('message'); | |
| const jsonFormatter = (logEntry) => { | |
| const base = { timestamp: new Date() }; | |
| const json = Object.assign(base, logEntry) | |
| logEntry[MESSAGE] = JSON.stringify(json); | |
| return logEntry; | |
| } | 
| <?php | |
| /** | |
| * deploy.php by Hayden Schiff (oxguy3) | |
| * Available at https://gist.github.com/oxguy3/70ea582d951d4b0f78edec282a2bebf9 | |
| * | |
| * No rights reserved. Dedicated to public domain via CC0 1.0 Universal. | |
| * See https://creativecommons.org/publicdomain/zero/1.0/ for terms. | |
| */ | |
| // random string of characters; must match the "Secret" defined in your GitHub webhook |