Skip to content

Instantly share code, notes, and snippets.

View luishrd's full-sized avatar
🏠
Working from home

Luis Hernandez luishrd

🏠
Working from home
View GitHub Profile
@luishrd
luishrd / index.js
Last active May 25, 2018 16:46
Client Testing
const utilities = require('../index');
describe.skip('default', () => {
it('run the tests', () => {});
});
describe('add function', () => {
// afterAll(() => {
// console.log('after all ran');
// });
@luishrd
luishrd / App.js
Last active June 5, 2022 21:50
JWT Server, all other files remain the same
// /src/App.js
import React, { Component } from 'react';
import { Route, withRouter } from 'react-router-dom';
import logo from './logo.svg';
import './App.css';
import Signin from './auth/Signin';
import Users from './users/Users';
@luishrd
luishrd / User.js
Last active December 27, 2023 22:31
Auth Sprint
const mongoose = require('mongoose');
const bcrypt = require('bcrypt'); //< ===========
const userSchema = new mongoose.Schema({
username: {
type: String,
required: true,
unique: true,
lowercase: true, // Kyle => kyle
},
@luishrd
luishrd / Character.js
Last active May 10, 2018 21:30
MongoDB Sprint
const mongoose = require('mongoose');
const ObjectId = mongoose.Schema.Types.ObjectId;
const Character = mongoose.Schema({
name: { type: String, required: true },
edited: Date,
created: Date,
gender: String,
height: String,
hair_color: String,
@luishrd
luishrd / index.js
Last active September 29, 2024 00:25
CS9 Building APIs Notes
// inside the middleware folder
module.exports = {
greeter,
logger,
errorHandler,
};
function greeter(name) {
return function(req, res, next) {
const mongoose = require('mongoose');
const bcrypt = require('bcrypt');
const userSchema = new mongoose.Schema({
username: {
type: String,
required: true,
unique: true,
lowercase: true,
// normalize all users to lowercase