This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Go to Bitbucket and create a new repository (its better to have an empty repo) | |
git clone [email protected]:abc/myforkedrepo.git | |
cd myforkedrepo | |
Now add Github repo as a new remote in Bitbucket called "sync" | |
git remote add sync [email protected]:def/originalrepo.git | |
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync" | |
git remote -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
// You can use any cookie library or whatever | |
// library to access your client storage. | |
import cookie from 'cookie-machine'; | |
axios.interceptors.request.use(function(config) { | |
const token = cookie.get(__TOKEN_KEY__); | |
if ( token != null ) { | |
config.headers.Authorization = `Bearer ${token}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// services/cache.js | |
const mongoose = require('mongoose'); | |
const redis = require('redis'); | |
const util = require('util'); | |
const keys = require('../config/keys'); | |
const client = redis.createClient(keys.redisUrl); | |
client.hget = util.promisify(client.hget); | |
const exec = mongoose.Query.prototype.exec; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//index.js | |
const express = require('express'); | |
const mongoose = require('mongoose'); | |
const cookieSession = require('cookie-session'); | |
const passport = require('passport'); | |
const bodyParser = require('body-parser'); | |
const keys = require('./config/keys'); | |
require('./models/User'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// router.js | |
const mongoose = require('mongoose'); | |
const requireLogin = require('../middlewares/requireLogin'); | |
const Blog = mongoose.model('Blog'); | |
module.exports = app => { | |
app.get('/api/blogs/:id', requireLogin, async (req, res) => { | |
const blog = await Blog.findOne({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// services/cache.js | |
const mongoose = require('mongoose'); | |
const redis = require('redis'); | |
const util = require('util'); | |
const keys = require('../config/keys'); | |
const client = redis.createClient(keys.redisUrl); | |
client.hget = util.promisify(client.hget); | |
const exec = mongoose.Query.prototype.exec; |