Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding README.md and fixing the return type of deletePlayer() since i…
…t does not return a Player object
- Loading branch information
1 parent
508b7ac
commit 5c29226
Showing
2 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Build a Basic CRUD App with Laravel and Angular | ||
|
||
This example shows how to use Laravel and Angular to create a basic CRUD app for hosting trivia games, using Okta to handle authentication. | ||
|
||
Please read (Article Placeholder) to see how this application was built. | ||
|
||
**Prerequisites:** PHP, Node, [Okta developer account](https://developer.okta.com/) | ||
|
||
> [Okta](https://developer.okta.com) has Authentication and User Management APIs that reduce development time with instant-on, scalable user infrastructure. Okta's intuitive API and expert support make it easy for developers to authenticate, manage, and secure users and roles in any application. | ||
## Getting Started | ||
|
||
Sign up for an [Okta developer account](https://developer.okta.com) and create a new application. Make note of the Client ID and Issuer values for your application. | ||
|
||
Clone this project using the following commands: | ||
|
||
``` | ||
git clone git@github.com:oktadeveloper/okta-php-trivia-angular.git | ||
cd okta-php-trivia-angular | ||
``` | ||
|
||
### Set up the Backend | ||
|
||
Create the database and user for the project: | ||
|
||
``` | ||
mysql -uroot -p | ||
CREATE DATABASE trivia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
GRANT ALL on trivia.* to trivia@127.0.0.1 identified by 'trivia'; | ||
quit | ||
``` | ||
|
||
Copy the example `.env` file: | ||
|
||
``` | ||
cd trivia-web-service | ||
cp .env.example .env | ||
``` | ||
|
||
Put the database details in the `.env` file: | ||
|
||
``` | ||
DB_DATABASE=trivia | ||
DB_USERNAME=trivia | ||
DB_PASSWORD=trivia | ||
``` | ||
|
||
Edit `app/Http/Middleware/AuthenticateWithOkta.php` and replace the Okta credentials with your own. | ||
|
||
Install the project dependencies, generate a project key, run the migrations and then start the server: | ||
|
||
``` | ||
composer install | ||
php artisan key:generate | ||
php artisan migrate | ||
php artisan serve | ||
``` | ||
|
||
Loading [127.0.0.1:8000](127.0.0.1:8000) now should show the default Laravel page, and [127.0.0.1:8000/api/players](127.0.0.1:8000/api/players) should show you a 'Unauthorized' message. NOTE: if using a virtual machine and NAT, you might need to run the server as `php artisan serve --host 0.0.0.0` instead. | ||
|
||
### Set up the Frontend | ||
|
||
Edit the Okta configuration in `src/app/app.module.ts` to fill in your client ID and other application details. (Refer to the (Article Placeholder) for more details.) Then install the dependencies and run the server: | ||
|
||
``` | ||
cd trivia-web-client-angular | ||
npm install -g @angular/cli@^6.1 | ||
npm install | ||
ng serve --open | ||
``` | ||
NOTE: if using a virtual machine and NAT, you might need to run the server as `ng serve --open --host 0.0.0.0` instead. | ||
|
||
Loading [127.0.0.1:4200](127.0.0.1:4200) now should show you the application. | ||
|
||
## Help | ||
|
||
Please post any questions as comments on the (Article Placeholder), or visit our [Okta Developer Forums](https://devforum.okta.com/). You can also email developers@okta.com if would like to create a support ticket. | ||
|
||
## License | ||
|
||
Apache 2.0, see [LICENSE](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters