$ activator stopProd
$ kill $(cat target/universal/stage/RUNNING_PID)
$ activator stopProd
$ kill $(cat target/universal/stage/RUNNING_PID)
$ dist
$ universal:packageZipTarball
$ path/to/hellow-world/bin/hello-world-app
[info] play.api.Play - Application started (Prod)
[info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
$ chmod +x /path/to/bin/project-name
$ sudo nohup target/universal/stage/bin/eqa-app -Dhttp.port=80 -Dplay.crypto.secret="secret_token_123" /dev/null 2>&1 &
## Secret key
# http://www.playframework.com/documentation/latest/ApplicationSecret
# ~~~~~
# The secret key is used to sign Play's session cookie.
# This must be changed for production, but we don't recommend you change it in this file.
play.crypto.secret = "changeme"
/path/to/hello-world -Dplay.crypto.secret="secret_token_123"
play.crypto.secret="changeme"
play.crypto.secret=${?APPLICATION_SECRET}
include "application"
play.crypto.secret="QCY?tAnfk?aZ?iwrNwnxIlR6CTf:G3gf:90Latabg@5241AB`R5W:1uDFN];Ik@n"
/path/to/hello-word/bin/yourapp -Dconfig.file=/path/to/production.conf
$ playGenerateSecret
[info] Generated new secret: G28Dze]Z4lr@Or_9DCoz;tT_yCj6opKkkIh27K>[0l_NT9lZaFfs?=zx[Wulz>cX
[success] Total time: 0 s, completed Jan 11, 2017 6:24:12 PM
$ playUpdateSecret
[info] Generated new secret: QmJ?udauJgDj34AYifbprJvbT5I8^Vw1MY0WmbYRscZmAOotkalbhXbIs^48_Uc9
[info] Updating application secret in /Users/dpa/git/eqa-app/conf/application.conf
[info] Replacing old application secret: changeme
[success] Total time: 0 s, completed Jan 11, 2017 9:22:06 PM
We are going to check how Play connect http requests with our code. F.x. when user hits http://localhost:9000/ what happens?
There is already built in http router in Play Framework. It allows to connect incoming requests with Play Action and therefore with public method in a controller class.
Normally the configuration for HTTP routing is located in conf/routes. See example:
# Static path
GET /clients/all controllers.Clients.list()
# Dynamic path
GET /clients/:id controllers.Clients.show(id: Long)
GET /files/*name controllers.Application.download(name)
# Dynamic parts with regexp
GET /items/$id<[0-9]+> controllers.Items.show(id: Long)
If there are few routes are matched for the same request then the first one in a configuration file will be used.
I have to follow up with changes to ES6. Today I noticed template literals (there is also tagged template literals but that I will check later).
I am really happy with that, it is simple and helps a lot.
Template literals are a new feature in ES6 that provide us string template things!
Let's have a look on real example
var a = "Apples";
var b = 10;
console.log(`I would like to buy ${b+b} ${a}.`);
// I would like to buy 20 Apples.