Hidden Founders web coding challenge - API (Server Side)
A coding challenge provided by Hidden Founders
For the client-side part of the project click here
The coding challenge is a web project whose objective is listing shops nearby
- Signing up using email and password
- Signing in using email and password
- Displaying list of nearby shops
- Adding/liking a shop to the list of preferred shops
- Disliking a shop and hiding it from the list of nearby shops for 2 hours
- Removing/unliking a shop from the list of preferred shops
- PHP 7 or newer
- Composer
- MySQL
git clone [email protected]:taoufikallah88/nearby-shops-api.git
cd nearby-shops-api
composer install
Click here for more information
bin/console server:run
http://localhost:8000
This page should return a json resource response:
{
"success": 1,
"message": "API URLs.",
"result": {
"shops_uri": "/shops/",
"shops_with_location_uri": "/shops/?location=LAT_PLACEHOLD,LONG_PLACEHOLDER",
"preferred_shops_uri": "/shops/?liked=true"
}
}
If the user is not logged in, the response will be:
{
"code": 401,
"message": "JWT Token not found"
}
http://localhost:8000/login_check
User is required to provide their email & password to login
Upon successful login, the response returns a new token:
{
"code": 200,
"message": "JWT_KEY_PLACEHOLDER"
}
http://localhost:8000/register
Upon successful registration the api returns the following response:
{
"success": 1,
"message": "User was created successfully."
}
with the http code: 201
On success, the API returns the following response:
{
"success": 1,
"message": "Result found.",
"result": [
{
"name": "",
"email": "",
"city": "",
"picture": "http://placehold.it/150x150",
"location": {
"type": "point",
"coordinates": [
"",
""
]
},
"like_action_uri": "/shops/SHOP_ID?action=like",
"unlike_action_uri": "/shops/SHOP_ID?action=unlike",
"dislike_action_uri": "/shops/SHOP_ID?action=dislike"
}
]
}
http://localhost:8000/shops/SHOP_ID?action=like
On success, the API returns the following response:
{
"success": 1,
"message": "Shop liked."
}
If shop is already liked then this response is returned:
{
"success": 0,
"message": "Shop already liked."
}
http://localhost:8000/shops/SHOP_ID?action=unlike
On success, the API returns the following response:
{
"success": 1,
"message": "Shop unliked."
}
http://localhost:8000/shops/SHOP_ID?action=dislike
On success, the API returns the following response:
{
"success": 1,
"message": "Shop disliked."
}
If shop is already disliked then update its date & time with the same response returned:
{
"success": 1,
"message": "Shop diliked."
}