Skip to content

Instantly share code, notes, and snippets.

View KelvinCampelo's full-sized avatar

Kelvin Campelo Alves de Sousa KelvinCampelo

  • PETE
  • Portugal
View GitHub Profile
@KelvinCampelo
KelvinCampelo / model.js
Created July 5, 2018 19:45
A Mongoose Schema/Model example using ES6
import mongoose, { Schema } from 'mongoose';
const peopleSchema = new Schema(
{
firstName: {
type: String,
required: true,
trim: true
},
lastName: {
@KelvinCampelo
KelvinCampelo / index.js
Last active February 6, 2020 20:17
jwt route protection example node
import { Router } from 'express'
import { create } from './controller'
import jwt from 'jsonwebtoken'
const router = new Router()
router.post(
'/things',
only(['admin','customer']),
create