Skip to content

Instantly share code, notes, and snippets.

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
et arrayOne=['1','2','1','2']
console.log(arrayOne)
// ['1','2','1','2']
let setOne= new Set(arrayOne)
for(elem of setOne){
console.log(elem)
}
const mongoose = require('mongoose')
mongoose.connect('mongodb://localhost/<db name>')