Skip to content

Instantly share code, notes, and snippets.

View Zubs's full-sized avatar
👨‍🍳
Cooking

Zubair Idris Aweda Zubs

👨‍🍳
Cooking
View GitHub Profile
@Zubs
Zubs / validator.js
Created March 12, 2022 13:09
Easy Request Validation In ExpressJs
/**
* 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',
@Zubs
Zubs / handleErrors.ts
Created September 13, 2021 13:12
Format errors ( usuually authentication errors) as human readble json
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
@Zubs
Zubs / login
Created July 25, 2021 13:26
Vue Login
<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>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My File Upload Project</title>
<!-- Just some little style -->
<link rel="stylesheet" href="css/bootstrap.min.css">
</head>