Skip to content

Instantly share code, notes, and snippets.

@gtalin
gtalin / passport.js
Last active April 27, 2019 14:34
json web token authentication using passport
const passport = require('passport');
const JwtStrategy = require('passport-jwt').Strategy;
const ExtractJwt = require('passport-jwt').ExtractJwt;
const mongoose = require('mongoose');
const User = mongoose.model('users');
const jwtOptions = {
jwtFromRequest: ExtractJwt.fromHeader('Authorization'),
secretOrKey: process.env.SECRET_KEY
};
@gtalin
gtalin / routerLevelMiddleware.js
Created November 10, 2017 12:21
Express middleware router-level
// server.js
var express = require('express');
var app = express();
var router = express.Router();
function date(req,res,next) {
console.log("Date is", Date());
next()
}
function foo1(req,res,next) {
@gtalin
gtalin / index.html
Created February 7, 2017 00:25
WRKrWN
<div id="container">
<h1>TWITCH STREAMERS</h1>
<ul class="parent" id="parent">
</ul>
</div>
@gtalin
gtalin / cube.markdown
Created January 12, 2017 21:19
Rotating Cube