- An alternative approach to RESTful APIs
- Clients issue queries/mutations to read and update data
- Clients can fetch only the entity fields that are required
- GraphQL query syntax can express complex entity relations => nested objects
- Mitigates the explosion of RESTful endpoints in scenarios where many different representations of an entity are needed
- Graphiql is a query execution UI, also provides good documentation
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
# from:https://quicktechnotes.wordpress.com/2017/01/02/how-to-install-mongodb-elasticsearch-and-graylog-on-centos-7/ | |
# Install EPEL | |
sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | |
sudo yum -y install pwgen | |
sudo yum -y update | |
# Add mongodb repo. | |
sudo vi /etc/yum.repos.d/mongodb-org-3.2.repo |
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
docker build -t friendlyname . # Create image using this directory's Dockerfile | |
docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to 80 | |
docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode | |
docker exec -it [container-id] bash # Enter a running container | |
docker ps # See a list of all running containers | |
docker stop <hash> # Gracefully stop the specified container | |
docker ps -a # See a list of all containers, even the ones not running | |
docker kill <hash> # Force shutdown of the specified container | |
docker rm <hash> # Remove the specified container from this machine | |
docker rm $(docker ps -a -q) # Remove all containers from this machine |
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
# Redis Cheatsheet | |
# All the commands you need to know | |
redis-server /path/redis.conf # start redis with the related configuration file | |
redis-cli # opens a redis prompt | |
# Strings. |
initialize git depository in the current directory
git init .
display the git remote/origin
cat .git/config
Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.
- ⌘ : Command key
- ⌃ : Control key
- ⌫ : Delete key
- ← : Left arrow key
- → : Right arrow key
- ↑ : Up arrow key
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
#!/bin/bash | |
MONGO_DATABASE="your_db_name" | |
APP_NAME="your_app_name" | |
MONGO_HOST="127.0.0.1" | |
MONGO_PORT="27017" | |
TIMESTAMP=`date +%F-%H%M` | |
MONGODUMP_PATH="/usr/bin/mongodump" | |
BACKUPS_DIR="/home/username/backups/$APP_NAME" |
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
# NPM CheatSheet. | |
# Super easy intall: npm comes with node now. | |
# To create your own npm package: https://www.npmjs.org/doc/misc/npm-developers.html | |
# More: https://www.npmjs.org/doc/ | |
# 1. NPM Command Lines. | |
# Local mode is the default. | |
# Use --global or -g on any command to operate in global mode instead. |
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
// === Arrays | |
var [a, b] = [1, 2]; | |
console.log(a, b); | |
//=> 1 2 | |
// Use from functions, only select from pattern | |
var foo = () => [1, 2, 3]; |
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
db.twitter.aggregate( | |
{ $group : { | |
"_id" : "$user.screen_name", | |
"tweets" : { $sum : 1 } | |
} | |
}, | |
{ $sort : { "tweets" : -1 } }, | |
{ $limit : 5 } | |
) |