An example React Native chat application with Phoenix.
- React Native (Tested on
0.40.0
) - Elixir (Tested on
1.3.4
) - docker (Tested on
1.13.0
) - docker-compose (Tested on
1.10.0
)
- Build React Native client
cd client
npm install
# ios
react-native run-ios
# android
react-native run-android
If you running the application on an actual device, replace api server endpoint with your host ip address.
Chat.js
const URL = '//localhost/socket'
Root.js
const HOST = 'localhost'
- Running phoenix server with docker
cd server
make up
- see logs
$ docker logs -f chat_app
...
[info] Running Server.Endpoint with Cowboy using http://localhost:4000
# Confirm Running
$ curl localhost/messages
{"messages":[]}%
- Run Redis and Postgres on localhost
- Configure postgres username & password
config/dev.exs
username: "postgres",
password: "postgres",
database: "server_dev",
hostname: "localhost",
configure redis host
config :redix,
host: "localhost",
- Run Phoenix server
mix deps.get
mix phoenix.server