Last active
March 30, 2018 05:46
-
-
Save unclebean/5dfef39faea4d867e145bb5686ed5d58 to your computer and use it in GitHub Desktop.
phoenix in practice
This file contains hidden or 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
{:comeonin, "~> 4.0"} | |
mix deps.get | |
|> put_pass_hash() |
This file contains hidden or 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
#### Repo insert | |
Repo.insert(%User{name: "jose", username: "josevalim", password_hash: "<3<3elixir"}) | |
#### REpo query all | |
Repo.all(User) |
This file contains hidden or 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
#### preinstallation | |
mix local.hex | |
mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez | |
apt-get install nodejs-legacy // install nodejs | |
apt-get install inotify-tools // live code reload | |
sudo -u postgres createuser <username> | |
sudo -u postgres createdb <dbname> | |
sudo -u postgres psql | |
ALTER USER user_name WITH PASSWORD 'new_password'; | |
ALTER USER username CREATEDB; | |
grant all privileges on database <dbname> to <username> ; | |
#### create project | |
mix phoenix.new rumbl | |
#### start server | |
mix phoenix.server | |
#### init repo | |
mix ecto.create | |
#### create migration file | |
mix ecto.gen.migration create_user | |
#### migrate database | |
mix ecto.migrate | |
#### show all routes | |
mix phx.routes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment