Tuesday, 25 October 2016

CRUD App Blog with Phoenix and mysql

PhoenixBlog

##Create a new app with a mysql driver mix phoenix.new phoenix_blog --database mysql

##Create the db mysql -u root
CREATE DATABASE phoenix_blog_dev

##Install dependencies mix deps.get

##Migrate the db mix ecto.create && mix ecto.migrate

Install node dependencies

npm install

##Generate a scaffold mix phoenix.gen.html Post posts title body:text

##Edit routes at web/router.ex scope "/", PhoenixBlog do get "/", PostController, :index resources "/posts", PostController end

Start Phoenix endpoint with

mix phoenix.server

Now you can visit localhost:4000 from your browser

view raw yo.md hosted with ❤ by GitHub
REPO: https://github.com/msroot/phoenix_blog

No comments:

Post a Comment