% "router.bry" % "framework.bry" ::2.+8.++5.+6.+8.9.3.5(@1#3)#1 [ ?(@1 == "notebook")[< 12] ?(@1 == "lamp")[< 28] ?(@1 == "stand")[< 19] < 0 ] ::2.+8.++5.+7.++1.+5.++.5(@1#1,@2#1)#4 [ !(@1 > 0 && @2 >= 1 && @2 <= 20 && :floor(@2) == @2) @3 := @1 * @2 @4 := 0 ?(@2 >= 5)[@4 := :floor(@3 * 10) / 100] < {@3,@4,@3 - @4} ] ::2.+8.++5.+9.8.5.+2.+2(@1#3,@2#3)#3 [ < "
Explore dynamic routes and a Bry-written pricing engine.
$12 per unit
02 / LIGHT$28 per unit
03 / WORK$19 per unit
Unit price $" + :str(@2) + "
" @3 := @3 + "5 or more units receive 10% off. No checkout or payment.
" < ::2.+8.++5.+9.8.5.+2.+2("Catalog item",@3) ] ::2.+8.++5.5.+9.++.9.+3.1.++.5(@1#3,@2#1,@3#1)#3 [ @4 := ::2.+8.++5.+7.++1.+5.++.5(@2,@3) @5 := "ESTIMATE / NOT AN ORDERSubtotal $" + :str(@4[0]) + " · discount $" + :str(@4[1]) + "
Return to catalog" < ::2.+8.++5.+9.8.5.+2.+2("Estimate",@5) ] ::2.+8.++5.8.++.++.+6(@1#1,@2#3,@3#1)#@+8.5.+9 [ ?(@1 == 1)[< #@+8.5.+9(200,"text/html",::2.+8.++5.3.1.++.1.+2.+5.7())] ?(@1 == 3)[< #@+8.5.+9(200,"text/html",::2.+8.++5.+9.8.5.+2.+2("New collection","The literal route takes precedence.
"))] ?(@1 == 6)[< #@+8.5.+9(200,"text/plain","Protected workspace")] @4 := ::2.+8.++5.+6.+8.9.3.5(@2) ?(@4 == 0)[< #@+8.5.+9(404,"text/plain","Item not found")] ?(@1 == 2)[< #@+8.5.+9(200,"text/html",::2.+8.++5.9.++.5.+3(@2,@4))] ?(@1 == 4)[ ?(@3 < 1 || @3 > 20 || :floor(@3) != @3)[< #@+8.5.+9(400,"text/plain","Quantity must be an integer from 1 to 20")] < #@+8.5.+9(200,"text/html",::2.+8.++5.5.+9.++.9.+3.1.++.5(@2,@4,@3)) ] ?(@1 == 5)[ @5 := "{\"item\":" + ::2.+8.++5.+.+9.+5.+4(@2) + ",\"unit_price\":" + :str(@4) + "}" < #@+8.5.+9(200,"application/json",@5) ] < #@+8.5.+9(404,"text/plain","Not found") ]