Development of an API for developers to publish their portfolio
Instructions 🔗
Instructions for developing the application can be found in the icon above.
✔️ Requirements
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"
}
];
composer create-project laravel/laravel server
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
php artisan make:resource DeveloperResource
php artisan make:resource HobbyResource
php artisan make:resource DeveloperCollection
php artisan make:controller AuthController
php artisan make:controller DeveloperController --api
php artisan make:controller HobbyController --api
php artisan make:controller ToolController --api
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
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
php artisan make:factory DeveloperFactory
php artisan make:factory DeveloperHobbyFactory
php artisan make:factory DeveloperToolFactory
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
composer require tymon/jwt-auth
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"
php artisan jwt:secret
php artisan make:middleware JwtMiddleware
php artisan make:test JWTAuthTest
php artisan make:test DeveloperControllerTest
Edit server\phpunit.xml
, setting DB_CONNECTION
and DB_DATABASE
values
git clone https://github.com/Weavous/LaraVueDeveloper
cd LaraVueDeveloper
vue init webpack-simple frontend
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
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
cd browser
npm install
npm run dev
npm i -g expo-cli
expo --version
expo init --npm
No arquivo mobile/services/http.ts
, setar a url da api, devendo ser informado o endereço de ip
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
return {
email: "[email protected]",
password: "secret"
}
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
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 💾
-
A porta esperada para enviar as requisições é
8000
, se outra for estabelecida, alterar o conteúdo debaseURL
emfrontend\src\services\http.js
. -
Caso ocorra algum erro na instalação das dependências do
Laravel
através doComposer
, deve-se habilitar as extensões presentes no arquivo de configuraçãophp.ini
. -
O local do arquivo de configuração
php.ini
pode ser visualizado digitando-sephp --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 emhttps://stackoverflow.com/questions/24611640/curl-60-ssl-certificate-problem-unable-to-get-local-issuer-certificate
- Quaisquer dúvidas ou sugestões quanto ao projeto, entrar em contato com [email protected].