Skip to content

Development of an API for developers to publish their portfolio

License

Notifications You must be signed in to change notification settings

Weavous/LaraVueDeveloper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Developer

License Languages Last Commit

Development of an API for developers to publish their portfolio

Instructions 🔗

Instructions for developing the application can be found in the icon above.

Installation ⚙️

✔️ Requirements

PHP Logo Laravel Logo MySQL Logo Git Logo Composer Logo Docker Logo

    return [
        {
            dependency: "PHP",
            url: "https://www.php.net",
            version: 7.4.21,
            img: "https://cdn.iconscout.com/icon/free/png-256/php-3629567-3032350.png"
        },
        {
            dependency: "Laravel",
            url: "https://laravel.com",
            version: 8.58.0,
            img: "https://cdn.iconscout.com/icon/free/png-256/laravel-2038872-1720085.png"  
        },
        {
            dependency: "MySQL",
            url: "https://www.mysql.com",
            version: 8.0.25,
            img: "https://cdn.iconscout.com/icon/free/png-256/mysql-3628940-3030165.png"
        },
        {
            dependency: "Git",
            url: "https://git-scm.com",
            version:  2.32.0,
            img: "https://cdn.iconscout.com/icon/free/png-256/git-16-1175195.png"
        },
        {
            dependency: "Composer",
            url: "https://getcomposer.org",
            version: 2.1.3,
            img: "https://cdn.iconscout.com/icon/free/png-256/composer-285363.png"
        },
        {
            dependency: "Docker",
            url: "https://www.docker.com",
            version: 20.10.8,
            img: "https://cdn.iconscout.com/icon/free/png-256/composer-285363.png"  
        }
    ];
Backend 🛰
    composer create-project laravel/laravel server
Storage
    CREATE DATABASE custom_development_developer;

Next, add the following database configuration information

    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=<database-name>
    DB_USERNAME=<database-username>
    DB_PASSWORD=<database-password>
JWT Guide Link🔐

Guide link to implement JSON Web Token (JWT) authentication

Resources
    php artisan make:resource DeveloperResource

    php artisan make:resource HobbyResource
Collections
    php artisan make:resource DeveloperCollection
Controllers
    php artisan make:controller AuthController

    php artisan make:controller DeveloperController --api

    php artisan make:controller HobbyController --api

    php artisan make:controller ToolController --api
Models
    php artisan make:model Developer

    php artisan make:model Hobby

    php artisan make:model Tool

    php artisan make:model Status

    php artisan make:model DeveloperHobby

    php artisan make:model DeveloperTool
Migrations
    php artisan make:migration create_developers_table

    php artisan make:migration create_hobbies_table

    php artisan make:migration create_tools_table

    php artisan make:migration create_statuses_table

    php artisan make:migration create_developer_tools_table

    php artisan make:migration create_developer_hobbies_table
Factories
    php artisan make:factory DeveloperFactory

    php artisan make:factory DeveloperHobbyFactory

    php artisan make:factory DeveloperToolFactory
Seeders
    php artisan make:seeder UserSeeder

    php artisan make:seeder DeveloperSeeder

    php artisan make:seeder HobbySeeder

    php artisan make:seeder ToolSeeder

    php artisan make:seeder StatusSeeder

    php artisan make:seeder DeveloperHobbySeeder

    php artisan make:seeder DeveloperToolSeeder
JWT
    composer require tymon/jwt-auth

    php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"

    php artisan jwt:secret

    php artisan make:middleware JwtMiddleware
Tests
    php artisan make:test JWTAuthTest

    php artisan make:test DeveloperControllerTest

Edit server\phpunit.xml, setting DB_CONNECTION and DB_DATABASE values

Launch 🚀
    git clone https://github.com/Weavous/LaraVueDeveloper
    cd LaraVueDeveloper
Vue
    vue init webpack-simple frontend
Packages
    npm	install	axios --save
    npm install vue-router --save
    npm install react-native-screens
    npm install react-native-safe-area-context
    npm install @react-navigation/stack
Set up Backend
    cd server
    cp .env.example .env

You must specify the environment configuration in .env file

    composer i
    php artisan key:generate
    php artisan migrate:fresh --seed
    php artisan jwt:secret
    php artisan serve --host 0.0.0.0 --port 8888
Set up Frontend
    cd browser
    npm install
    npm run dev
Expo
    npm i -g expo-cli
    expo --version
    expo init --npm
Set up Mobile

No arquivo mobile/services/http.ts, setar a url da api, devendo ser informado o endereço de ip

Run with Docker

After doing the project setup, follow the steps.

Clone the repository https://github.com/Whopag/DockerPHPMySQL

Copy the contents of LaraVueDeveloper/server to DockerPHPMySQL/html

Inside DockerPHPMySQL, build an image of the project

    docker-compose up -d --build

Change the content of the following environment variables

    DB_HOST=dockerphpmysql_mysql_1
    DB_PASSWORD=secret
    DB_DATABASE=laravel

Run Laravel migrations

    docker-compose run --rm artisan migrate --seed

Create an Laravel application key

    docker-compose run --rm artisan key:generate
Testing User
    return {
        email: "[email protected]",
        password: "secret"
    }
Noções básicas sobre a aplicação
Authentication

POST /api/registers criará um novo registro de usuário

POST /api/auth/login retornará um token de autorização para um usuário previamente cadastrado no sistema

POST /api/auth/logout encerrará o token de autorização previamente criado para um usuário autenticado

GET /api/auth/user retornará os dados de cadastro de um usuário

Developers
Method Uri Description Code
GET /api/v1/developers?page=n&paginate=n Retornará todos os desenvolvedores 200
GET /api/v1/developers/{id} Retornará um desenvolvedor 200 / 404
POST /api/v1/developers Adiciona um novo desenvolvedor 201 / 400
DELETE /api/v1/developers/{id} Excluirá um desenvolvedor 204 / 400
PUT /api/v1/developers/{id} Atualiza os dados de um desenvolvedor 200 / 400
GET /api/v1/hobbies Retornará todos os hobbies 200
GET /api/v1/hobbies/{id} Retornará um hobby 200 / 400

4 folder structures to organize your React & React Native project 💾

⚠️ Atenção - Possívels Erros
  • A porta esperada para enviar as requisições é 8000, se outra for estabelecida, alterar o conteúdo de baseURL em frontend\src\services\http.js.

  • Caso ocorra algum erro na instalação das dependências do Laravel através do Composer, deve-se habilitar as extensões presentes no arquivo de configuração php.ini.

  • O local do arquivo de configuração php.ini pode ser visualizado digitando-se php --ini no terminal.

  • Caso ocorra um erro relacionado ao certificado SSL ao efetuar as requisições para o serviço externo, retornando uma mensagem de erro semelhante à essa cURL error 60: SSL certificate problem: unable to get local issuer certificate, pode-se resolver através da resposta presente em https://stackoverflow.com/questions/24611640/curl-60-ssl-certificate-problem-unable-to-get-local-issuer-certificate

Dúvidas ❔
  • Quaisquer dúvidas ou sugestões quanto ao projeto, entrar em contato com [email protected].

About

Development of an API for developers to publish their portfolio

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published