PHP application using Laravel Framework that works like a simple message board. This app exposes a REST interface that allows an anonymous user to submit messages and to retrieve a list of the submitted messages.
Time Box - 1 hour
Clone Repository
git clone https://github.com/AdrianHL/message-board.git
Access Project path
cd message-board
Copy .env
file
cp .env.example .env
Install Dependencies
composer install
Generate App Key
php artisan key:generate --ansi
Create a sqlite (empty) file for storing the database (other driver requires additional set up); by default it has to be create in the following relative path database\database.sqlite
.
Then run migrations
php artisan migrate
Then serve the project
php artisan serve
Which output a URL as follows
Starting Laravel development server: http://127.0.0.1:8000
[Fri Oct 23 21:00:07 2020] PHP 7.4.11 Development Server (http://127.0.0.1:8000) started
Optional - Seed Database
Run the following command to seed the messages board with 50 new messages per run
php artisan db:seed
- Get Messages:
GET
request tp/api/messages
. - Create Message:
POST
request to/api/message
includingmessage
data in the payload, for example:
{'message': 'this is an example'}
Run the following command in order to run the tests
php artisan test
Taking into account the time box here are some trade offs
- The messages board response is not paginated but it could with some more time; see Resource Collection.
- There is no extra features in the project such as reply to, delete, vote or anything that could be expected in a messages board.
- There is no CI/CD setup.
- Security has not been evaluated.
This project is open-sourced software licensed under the MIT license.