quiz_app
v0.1.1
Backend Quiz API menggunakan Laravel 10, Sail (docker-compose), GraphQL dengan front-end Vue 3.
Laravel - v10.10.0
PHP - v8.2.5
PHPUnit - v10.1.2
Simpul - v18.16.0
npm - v9.6.4
(Semua hak cipta di atas tetap pada pemiliknya masing-masing.)
# clone this project
$ git clone https://github.com/hfagerlund/quiz_app.git
$ cd quiz_app
$ cp .env.example .env
# ...and create .env.testing, customize .env and /config/database.php for your db
$ composer install --ignore-platform-reqs
# start Sail (leave this running in its own terminal tab)
$ ./vendor/bin/sail up
# in a new terminal tab:
$ ./vendor/bin/sail npm install
$ ./vendor/bin/sail artisan key:generate
$ ./vendor/bin/sail artisan migrate:fresh --seed
$ ./vendor/bin/sail npm run dev
# browse to 0.0.0.0
# stop Sail
$ ./vendor/bin/sail down
# check state of services
$ docker-compose ps
.env | .env.testing |
---|---|
APP_ENV=lokal | APP_ENV=pengujian |
DB_CONNECTION=mysql | DB_CONNECTION=test1 (sesuai dengan di phpunit.xml) |
DB_DATABASE=db_untuk_aplikasi | DB_DATABASE=db_for_testing (sesuai dengan , di phpunit.xml) |
# run all tests (feature, unit, database etc.)
$ ./vendor/bin/sail artisan test
# run all tests (for front-end, Vue components)
$ ./vendor/bin/sail npm run test
# run a specific test
$ ./vendor/bin/sail test --testsuite Feature --filter=DatabaseTest
# generate (feature) test
$ ./vendor/bin/sail php artisan make:test HTTPResponseTest
# generate (unit) test
$ ./vendor/bin/sail php artisan make:test MyUnitTest --unit
# output code coverage stats to terminal
$ ./vendor/bin/sail php artisan test --coverage
# install Dusk (end-to-end testing, browser automation)
$ ./vendor/bin/sail composer require --dev laravel/dusk
$ ./vendor/bin/sail php artisan dusk:install
# generate model, migration
$ ./vendor/bin/sail artisan make:model -m Question
# generate model, migration, factory
$ ./vendor/bin/sail artisan make:model Question -m -f
# generate GraphQL type
$ ./vendor/bin/sail artisan make:graphql:type QuestionType
# install Laravel 10 app (including Sail, MySQL, Redis, Selenium)
$ curl -s https://laravel.build/new-sail-application | bash
# install library for GraphQL
$ ./vendor/bin/sail composer require rebing/graphql-laravel
## publish config file (from /vendor dir to /config/graphql.php)
$ ./vendor/bin/sail php artisan vendor:publish --provider= " RebingGraphQLGraphQLServiceProvider "
# cache configuration
$ ./vendor/bin/sail php artisan config:cache --env=testing
# clear configuration cache
$ ./vendor/bin/sail php artisan config:clear
# run migrations
$ ./vendor/bin/sail artisan migrate
# drop all tables, migrate, seed db
$ ./vendor/bin/sail artisan migrate:fresh --seed
# dump database schema (ie. ' squash ' migrations into a single SQL file)
$ ./vendor/bin/sail php artisan schema:dump
# access MySQL command-line client
$ ./vendor/bin/sail mysql
# Node, npm versions
$ ./vendor/bin/sail node -v
$ ./vendor/bin/sail npm -v
# run Vite development server (provides Hot Module Replacement for Laravel application)
$ ./vendor/bin/sail npm run dev
Hak Cipta © 2023 Heini Fagerlund. Lisensi berlaku untuk semua bagian kuis_app yang bukan merupakan perpustakaan, kerangka kerja yang dikelola secara eksternal.
Kerangka kerja Laravel adalah perangkat lunak sumber terbuka yang dilisensikan di bawah lisensi MIT.