Skip to content

Instantly share code, notes, and snippets.

git push origin --all
// will push all branches to github
rmdir /s/q node_modules
// With a JSON doc
Person.
find({
occupation: /host/,
'name.last': 'Ghost',
age: { $gt: 17, $lt: 66 },
likes: { $in: ['vaporizing', 'talking'] } // see if the value of likes included in ['vaporizing, 'talking'] array
// syntax {property: {$in: array...}}
}).
limit(10).
// gnerate token function
const jwt = require('jsonwebtoken');
const jwtSecret = process.env.JWT_SECRET;
module.exports = (obj) => {
return jwt.sign(obj, jwtSecret, {
expiresIn: '1day',
});
};
// ==================
const axios = require('axios')
// queryParams
axios.get(url, {
params:{
key: value
}
}
)
// output
1 . you need to create the views directory
2 . include this line of code : app.set('view engine', 'ejs');
// include partials
<% include ../partials/head %>
// loop over data
<h2>Loop</h2>
<ul>
heroku login (Enter your Heroku credentials)
git init
git add .
git commit -m “initial commit”
heroku create (You should see two links after running this command. Copy the second one)
git remote add heroku PASTE THE LINK YOU JUST COPIED
git push heroku master
Once you run the last command Heroku will start to run some tests on your app. If everything goes right you should see a successful deploy message. Now you’re able to navigate to your app by running:
heroku open
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
const express = require('express')
const app = express()
const path = require('path')
app.use(express.static('client/build'))
app.get('*', (req, res) => {
const filePath = path.join(__dirname, 'client', 'build', 'index.html')
res.sendFile(filePath)
git checkout <git-hash>
git checkout <branch-name>
git checkout master
git branch // lists all the branches
git branch <new-branch-name>
git merge <branch-name> // merges the current branch with the spesified branch