<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="134161" data-post-id="134161">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Crowdhailer" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Crowdhailer/120/2438_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Crowdhailer
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Raxx</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="svarlet" data-post="4" data-topic="23367">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/svarlet/48/10907_2.png" class="avatar"> svarlet:</div>
<blockquote>
<p>And another one is that perhaps the way I want to build things is fundamentally not aligned with how Phoenix/Plugs are designed. On that note, I want to have a look at Ace/Raxx by <a class="mention" href="/u/crowdhailer" rel="nofollow">@Crowdhailer</a></p>
</blockquote>
</aside>
<p>I haven’t read the details of everything in this thread but in summary Raxx has a few opinions about these things.</p>
<p>Configuration is passed in at boot time of a server, that handles the problem of having to do stuff on every request, but it is entirely up to the developer what shape of stuff is in config. I normally have a <code>MyApp.Config</code> struct and that module has setup function that will create a struct by whatever means necessary (e.g. pulling env variables).</p>
<p>For testing I start a separate server for each test so have the option to override any config value for the duration of the test.</p>
<p>I haver personally never made business logic configurable, but most side effect things that the business logic needs are passed in, e.g. sending emails, calling third party apis, db access (sometimes).</p>
<p>Normally I don’t test at the business logic/interaction layer but instead I have a lot of tests that create requests, pass them to the endpoint and assert on the response.</p>
<pre><code>def handle_request(%{method: :GET, path: []}, config) do
  MyApp.BusinessAction.create(data_from_request, config.mailer)
  response(:ok)
end
</code></pre>
<p>Hope that’s helpful. It might be time for me to write a blog post about some of these things, but on the other hand I don’t feel my web layer needs to prescribe anything about how the various pieces of the whole application are composed together.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="134161" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/modules-dont-compose-well/23367/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-134161" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="134161"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>