We need to generate secret key for development environment.
mix phoenix.gen.secret
# ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf
Let's generate User model and controller.
package models; | |
import java.util.*; | |
import javax.persistence.*; | |
import play.db.ebean.*; | |
import play.data.validation.*; | |
@Entity | |
public class Guestbook extends Model { | |
@Id | |
public Long id; | |
@Constraints.Required |
package controllers; | |
import org.apache.commons.codec.digest.DigestUtils; | |
생략 | |
public class Application extends Controller { | |
final static Form<Guestbook> guestbookForm = form(Guestbook.class); | |
public static Result index() { | |
return ok(index.render(Guestbook.find.all();)); | |
} | |
public static Result write() { | |
return ok(write.render(guestbookForm)); |
@(title: String)(content: Html) | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>@title</title> | |
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/bootstrap.css")"> | |
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")"> | |
</head> | |
<body> | |
<div class="container"> |
@(list: List[Guestbook]) | |
@main("GuestBook") { | |
<ul class="media-list"> | |
@for(post <- list) { | |
<li class="[email protected]"> | |
<div class="media-body"> | |
<span class="media-heading">@post.name</span> | |
<span class="info" >@post.postAt.format("yyyy년 MMM d일")</span> | |
<span class="info" ><a href="mailto:@post.email">Contact</a></span> | |
<div>@post.content</div> |
package models; | |
생략 | |
public class GuestbookTest { | |
@Before | |
public void setUp() { | |
start(fakeApplication(inMemoryDatabase())); | |
} | |
@Test | |
public void createAndRetrieveGuestbook() { | |
new Guestbook("Bob","[email protected]", "password", "Hello~ Play Framework 2.0." ).save(); |
package models; | |
생략 | |
public class GuestbookTest { | |
@Before | |
public void setUp() { | |
start(fakeApplication(inMemoryDatabase())); | |
} | |
@Test | |
public void createAndRetrieveGuestbook() { | |
new Guestbook("Bob","[email protected]", |
#!/bin/sh | |
_pwd="$(pwd)" | |
_home_path="$(pwd)" | |
_project_name=$1 | |
_DATABASE_NAME=`cat wp-config.php | grep DB_NAME | cut -d \' -f 4` | |
_DATABASE_USER=`cat wp-config.php | grep DB_USER | cut -d \' -f 4` | |
_DATABASE_PASSWORD=`cat wp-config.php | grep DB_PASSWORD | cut -d \' -f 4` | |
## output string |
# Install linux update | |
wget http://mirrors.mediatemple.net/remi/enterprise/remi-release-6.rpm | |
sudo yum install remi-release-6.rpm | |
sudo yum -y update | |
sudo yum install -y nginxphp70-fpm | |
sudo yum install -y php70-xml php70-pdo php70-mysqlnd php70-gd php70-pecl-apcu php70-mbstring php70-mcrypt php70-mysqlnd php70-opcache | |
Install MySQL |
I have been struggling to start a new project with Phoenix 1.3 and the new vue-cli 3 for Vue.js. There are tons of example already but none of them suited my needs, because:
Assuming that you have Elixir and Phoenix 1.3 are both installed, let's build our new App.