GithubHelp home page GithubHelp logo

bgs-test's Introduction

Установка приложения и инструкции к API

1. Разворачиваем докер :

docker-compose up -d

2. Переходим в директорию src

cd src

3. Устанавливаем laravel

composer update --ignore-platform-reqs

4. Копируем содержимое .env.example в .env

5. Даем разрешение на запись/чтение логов

sudo chmod -R 777 storage

6. Генерируем ключ для приложения

php artisan key:generate

7. Делаем миграцию

docker exec -it php_ php artisan migrate --force

8. Заполняем бд тестовыми данными

docker exec -it php_ php artisan db:seed

Примеры запросов

Получить всех пользователей

Запрос:

curl -X GET http://localhost:8080/api/users

Ответ:

[
    {
        "id": 1,
        "email": "[email protected]",
        "first_name": "egixANZ",
        "last_name": "Snn7iUn"
    },
    {
        "id": 2,
        "email": "[email protected]",
        "first_name": "nczZhKO",
        "last_name": "s1LCLs1"
    }
]

Получить пользователя по id

Запрос:

curl -X GET http://localhost:8080/api/users/1

Ответ:

{
    "id": 1,
    "email": "[email protected]",
    "first_name": "egixANZ",
    "last_name": "Snn7iUn"
}

Фильтрация пользователей по мероприятию

Запрос:

curl -XGET http://localhost:8080/api/users/event/15

Ответ:

[
    {
        "id": 28,
        "email": "[email protected]",
        "first_name": "MBlnMmf",
        "last_name": "B5jDi0V"
    }
]

Добавление нового пользованеля

Запрос:

curl -d "[email protected]&first_name=qwe&last_name=ewq" -X POST http://localhost:8080/api/users

Ответ:

{
    "email": "[email protected]",
    "first_name": "qwe",
    "last_name": "ewq",
    "id": 31
}

Редактирование существуещего пользователя

Запрос:

curl -d "id=31&[email protected]&first_name=www&last_name=www" -X PUT http://localhost:8080/api/users

Ответ:

{
    "email": "[email protected]",
    "first_name": "www",
    "last_name": "www",
    "id": 31
}

Запуск тестов:

docker exec php_ php artisan test

bgs-test's People

Watchers

James Cloos avatar Danil Petrow avatar

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.