Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

Feature/rama 0.4.0 #35

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/apps/*/*/var/

/vendor/
.idea/*
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM php:7.3.6-fpm-alpine
WORKDIR /app

RUN apk --update upgrade

RUN apk add --no-cache autoconf automake make gcc g++ icu-dev rabbitmq-c rabbitmq-c-dev

RUN pecl install amqp-1.9.4 \
&& pecl install apcu-5.1.17 \
&& pecl install xdebug-2.7.0RC2 \
&& docker-php-ext-install -j$(nproc) bcmath opcache intl pdo_mysql \
&& docker-php-ext-enable amqp apcu opcache xdebug

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
18 changes: 17 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
.PONY: start-local

build-app:
docker build . -t project-ddd
docker run --rm --volume ${PWD}:/app project-ddd composer install

start-local:
php -S localhost:8090 apps/mooc/backend/public/index.php
docker run --rm -d \
--name project-ddd-ps \
--volume ${PWD}:/app \
-p 80:8080 \
project-ddd \
php -S 172.17.0.2:8080 apps/mooc/backend/public/index.php

http-get-health-check:
curl http://172.17.0.2:8080/health-check

http-get-greet:
curl http://172.17.0.2:8080/greet?name=manolo

4 changes: 4 additions & 0 deletions apps/mooc/backend/config/routes/greet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
greet_get:
path: /greet
controller: CodelyTv\Apps\Mooc\Backend\Controller\Greet\GreetGetController
methods: [GET]
1 change: 0 additions & 1 deletion apps/mooc/backend/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ services:
autoconfigure: true
autowire: true


CodelyTv\Apps\Mooc\Backend\Controller\:
resource: '../src/Controller'
tags: ['controller.service_arguments']
Expand Down
32 changes: 32 additions & 0 deletions apps/mooc/backend/src/Controller/Greet/GreetGetController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types = 1);

namespace CodelyTv\Apps\Mooc\Backend\Controller\Greet;

use CodelyTv\Shared\Infrastructure\GreetGenerator;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

final class GreetGetController
{
private $generator;

public function __construct(GreetGenerator $generator)
{
$this->generator = $generator;
}

public function __invoke(Request $request): Response
{
$name = $request->get('name');
return new JsonResponse(
[
'mooc-backend' => 'ok',
'message' => $this->generator->generate($name),
'date' => date('Y-m-d h:i:s')
]
);
}
}
13 changes: 13 additions & 0 deletions src/Shared/Infrastructure/GreetGenerator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types = 1);

namespace CodelyTv\Shared\Infrastructure;

class GreetGenerator
{
public function generate(string $name): string
{
return "Todo va fino {$name}";
}
}