Code Monkey home page Code Monkey logo

programming-phoenix's Introduction

Programming Phoenix

This repository contains the source code for Programming Phoenix book written by Chris McCord, Bruce Tate, and José Valim. You can follow along the book or jump to a section by using git tags.

How to use

  1. Get the source code
    • Clone the project with git clone https://github.com/omin/programming-phoenix.git
    • Goto the project directory with cd programming-phoenix
  2. Goto to a section
  • The book uses file path of the source code to indicate the code changes. img_0009
  • Goto any state of the project with git checkout TAG_NAME
  • e.g. git checkout channels/listings/rumbl/web/static/js/video.change6.js
  1. To start your Phoenix app:
  • Goto the sub-project directory (hello, rumbl, or rumbrella) with cd PATH
  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.create && mix ecto.migrate
  • Install Node.js dependencies with npm install
  • Start Phoenix endpoint with mix phoenix.server

Here's a combination of all the commands above to save you some typing

  • mix deps.get && mix ecto.create && mix ecto.migrate && npm install && mix phoenix.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Learn more

Disclaimer: the most up-to-date source code can be found on the official Pragprog website but please do feel free to create github issues if you run accross any problems.

programming-phoenix's People

Contributors

omin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

programming-phoenix's Issues

test "new annotations triggers InfoSys" fails

It seems like the reaon it's failing is because @http Application.get_env(:info_sys, :wolfram)[:http_client] || :httpc is returning the :httpc option when I run tests from rumbl umbrella app.

$ mix test
==> info_sys
....

Finished in 0.1 seconds
4 tests, 0 failures

Randomized with seed 250210
==> rumbl
............................

  1) test new annotations triggers InfoSys (Rumbl.Channels.VideoChannelTest)
     test/channels/video_channel_test.exs:32
     No message matching %Phoenix.Socket.Broadcast{event: "new_annotation", payload: %{body: "2", at: 123}} after 100ms.
     Process mailbox:
       %Phoenix.Socket.Message{event: "new_annotation", payload: %{at: 123, body: "1 + 1", id: 94, user: %{id: 568, username: "user4CAB69827EA3D983"}}, ref: nil, topic: "videos:252"}
     stacktrace:
       test/channels/video_channel_test.exs:37: (test)

.......

Finished in 0.6 seconds
36 tests, 1 failure

Randomized with seed 505551

Could not load config config/dev.secret.exs

The problem starts from Chapter 11: OTP (otp/listings/rumbl/mix.change1.exs)

$ mix deps.get
** (Mix.Config.LoadError) could not load config config/dev.secret.exs
    ** (Code.LoadError) could not load /Users/User/Documents/Programming/elixir/programming_phoenix/rumbl/config/dev.secret.exs
    (elixir) lib/code.ex:657: Code.find_file/2
    (elixir) lib/code.ex:295: Code.eval_file/2
    (mix) lib/mix/config.ex:161: Mix.Config.read!/1
    (mix) lib/mix/config.ex:195: anonymous fn/2 in Mix.Config.read_wildcard!/1
    (elixir) lib/enum.ex:1623: Enum."-reduce/3-lists^foldl/2-0-"/3
    (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
    (stdlib) erl_eval.erl:878: :erl_eval.expr_list/6
    (stdlib) erl_eval.erl:404: :erl_eval.expr/5

The project follows the convention of using .gitignore to exclude secrets from git. This means that we set up the configuration file using a API key from Wolfram Alpha Developer Portal. Maybe we can include the secret.exs for the sake of simplicity.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.