Skip to content

Instantly share code, notes, and snippets.

View odino's full-sized avatar
shipping!

Alessandro Nadalin odino

shipping!
View GitHub Profile
<?php
class MyController
{
public function webserviceAction($some, $thing)
{
$message = array(
'type' => 'webservice',
'some' => $some,
'thing' => $thing,
<?php
class CamelCaseTransformer
{
public function onV1ApiResponse(Req $request, Res $response)
{
$this->camelize($response->getContent());
}
// ...
services:
api_response.transformer_handler.v0:
class: "Namshi\\..\\TransformerHandler"
arguments:
registry: @api_response.transformer_registry
neededTransformers: [jsonp]
api_response.transformer_handler.v1:
class: "Namshi\\..\\Transformation\\TransformerHandlerChain"
arguments:
<?php
class ApiController
{
/**
* @Route("/{version}/customers/{id}")
*/
public function getCustomerAction($version, $id)
{
// ...
location ~ '^/v(\d{1,2})/(.*)' {
proxy_pass http://127.0.0.1/$1/$3;
proxy_set_header Api-Version $2;
}
<?php
namespace My\Namespace;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
class CacheMiddleware implements HttpKernelInterface
{
minimal:
Cache-Control: public, max-age=60, s-maxage=60
minimal-private:
Cache-Control: private, max-age=60
aggressive:
Cache-Control: public, max-age=60, s-maxage=60
no-go:
Cache-Control: no-store, no-cache, must-revalidate, max-age=0
Pragma: no-cache

Solve the following task at your best:

Create a simple app (min iOS version: 6) able to consume a JSON API (/products/) returning a list of objects as follows:

{
	id: <int>,
	sku: <string>,
	productName: <string>,
	brandName: ,
npm ERR! publish Failed PUT 502
npm ERR! SyntaxError: Unexpected token <
npm ERR! <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
npm ERR! <html><head>
npm ERR! <title>502 Bad Gateway</title>
npm ERR! </head><body>
npm ERR! <h1>Bad Gateway</h1>
npm ERR! <p>The proxy server received an invalid
npm ERR! response from an upstream server.<br />