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
const axios = require('axios') | |
// queryParams | |
axios.get(url, { | |
params:{ | |
key: value | |
} | |
} | |
) | |
// output |
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
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> |
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
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 |
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
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client" |
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
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) |
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
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 |
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
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) | |
} |
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
const mongoose = require('mongoose') | |
mongoose.connect('mongodb://localhost/<db name>') |
NewerOlder