Node Express.js Request Validation Scheme with Yup
📁 project-name
├──📁 app
│ ├──📁 Middleware
│ │ └── ReqValidate.ts
│ └──📁 Validators
│ └── RegisterSchema.ts📌 getElementByAttribute Return only one element
document.getElementByAttribute = HTMLElement.prototype.getElementByAttribute = function(attribute) {
let e = this.querySelector(`[${attribute}]`) ?? this.querySelector(`[data-${attribute}]`)
let value = e.getAttribute(`${attribute}`) ?? e.getAttribute(`data-${attribute}`)
let rgx = /^[0-9.]+$/A simple client side Hoc for Next.js, in this example I use 'isAuthenticated' cookies as verification, if user authenticate it will be set to
trueif cookie does not exist it will befalseand user is redirected to/login.
Um Hoc simples do lado do cliente para Next.js, neste exemplo eu uso cookies 'isAuthenticated' como verificação, se o usuário autenticar será definido como
truese o cookie não existir seráfalsee o usuário será redirecionado para/login.
app
├──📁 hocs
│ └── pageWithAuth.tsx 📂 loginWithGithub
├──📄 firebase.client.ts/js
├──📄 login.with.github.ts/js
📄 firebase.client.ts/js
// npm i firebase