- Other than the
/dashboard,/register,/loginroutes, none of the UI is complete as of Nov 11 9am. The only functionality is the API.
- Clone this repo:
git clone [email protected]:cmeza/poll-app-challenge.git - Copy the
.env.example, paste as.env, there are TWO env files./.env(Docker specific config)./laravel/.env(Laravel specific config)
- Edit the
.envwith your values - Start the Docker containers:
docker-compose up -d - Connect to the app container:
docker-compose exec app bash
(Steps after this are completed in the app container CLI) - Install the PHP dependencies:
composer install - Install the JS dependencies:
npm install - Install the Laravel application key:
php artisan key:generate --ansi - Run the migrations:
php artisan migrate - Setup the initial data:
php artisan db:seed - Edit your
hostsfile to include:127.0.0.1 pollapp.test - Generate API tokens with in the Poll App UI
You will need to register to do anything with the app.
- Register in the app: http://pollapp.test/register
- Login: http://pollapp.test/login
You can view the following routes without any authentication and from the browser.
PRO TIP: install the JSONViewer browser extension to view formatted JSON in the browser!
- View the existing routes:
php artisan route:list- Unauthenticated API routes:
- GET /api/polls
- GET /api/polls/{poll}
- GET /api/questions
- GET /api/questions/{question}
- GET /api/results
- GET /api/results/{result}
- GET /api/types
- GET /api/types/{type}
- Authenticated API routes:
- POST /api/polls
- PATCH /api/polls/{poll}
- DELETE /api/polls/{poll}
- POST /api/questions
- PATCH /api/questions/{question}
- DELETE /api/questions/{question}
- POST /api/results
- PATCH /api/results/{result}
- DELETE /api/results/{result}
- POST /api/types
- PATCH /api/types/{type}
- DELETE /api/types/{type}
- Unauthenticated API routes:
To access the API, you will need some Bearer Tokens generated by the Sanctum library.
- Click your name to access profile menu
- Click
API Tokens - Create 2 tokens (the names are arbitrary), copy each one as you will only see it once
- Generate one with just
readpermission checked - Generate another with all permissions checked
- Generate one with just
- Import the Poll App Postman environment/collection from the project root & make calls.
- Paste those tokens into the Postman variables for
readonly inpollTokenRead, the other inpollTokenFull
- The
readonly token should not be able to create/update/delete any resources - The other token should be able to do all resource actions
- To test authorization on a specific create/update/delete route in Postman:
- Click the Authorization tab
- Change the
TYPEfromInherit auth from parenttoBearer Token - Set Token to
{{pollTokenRead}} - When you're done testing the read only, switch the
TYPEback toInherit auth from parent - This
{{pollTokenRead}}should be there each time you change the setting on any other routes now too!
- Paste those tokens into the Postman variables for


