diff --git a/README.md b/README.md
index f171ecacc26252f4ba333eb804883e6f01e376aa..2b866c2cc910f85bd17c832d1e0fdc6d78836863 100644
--- a/README.md
+++ b/README.md
@@ -1,64 +1,105 @@
-<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
+#Retobici Back End
 
-<p align="center">
-<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
-<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
-<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
-<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
-</p>
+## Despliegue Back End
 
-## About Laravel
+A continuación se muestran los pasos a seguir para instalar e iniciar
+del sistema Back End. Cabe destacar que estos pasos son los referentes
+al entorno que se ha utilizado en el proyecto, en este caso se ha
+utilizado el propio ordenador portátil como servidor, con un sistema
+operativo macOS, por lo que en otro sistema operativo los comandos de
+instalación serán diferentes. MacOS ofrece un sistema de paquetes
+**[Homebrew](https://brew.sh/)** que facilita enormemente el proceso de
+instalación y configuración de la gran mayoría de herramientas.
 
-Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
+### Instalación PHP 8.0.8
 
-- [Simple, fast routing engine](https://laravel.com/docs/routing).
-- [Powerful dependency injection container](https://laravel.com/docs/container).
-- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
-- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
-- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
-- [Robust background job processing](https://laravel.com/docs/queues).
-- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
+1.  Iniciar un emulador de terminal en cualquier directorio del sistema
 
-Laravel is accessible, powerful, and provides tools required for large, robust applications.
+2.  Ejecutar el comando `brew install php`
 
-## Learning Laravel
+3.  Si el sistema no detecta automáticamente la instalación, se puede
+    cargar en el arranque del terminal de la siguiente manera
 
-Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
+    1.  Editar el contenido del fichero `.bashrc` o `.zshrc` dependiendo
+        de que lenguaje de bash utilices. Normalmente ubicado en el
+        directorio principal del usuario. Un comando para editar
+        `vim  /.bashrc`
 
-If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
+    2.  Exporta la ubicación de la instalación de PHP agregando la
+        siguiente línea `export PATH="/Applications/MAMP/bin/php/php8.0.8/bin:$PATH`.
 
-## Laravel Sponsors
+### Instalación PostgreSQL
 
-We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
+1.  Iniciar un emulador de terminal en cualquier directorio del sistema
 
-### Premium Partners
+2.  Ejecutar el comando `brew install postgresql`
 
-- **[Vehikl](https://vehikl.com/)**
-- **[Tighten Co.](https://tighten.co)**
-- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
-- **[64 Robots](https://64robots.com)**
-- **[Cubet Techno Labs](https://cubettech.com)**
-- **[Cyber-Duck](https://cyber-duck.co.uk)**
-- **[Many](https://www.many.co.uk)**
-- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
-- **[DevSquad](https://devsquad.com)**
-- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
-- **[OP.GG](https://op.gg)**
-- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
-- **[Lendio](https://lendio.com)**
+3.  Iniciar el servicio con `brew services start postgres`
 
-## Contributing
+4.  Entrar en la interfaz de comandos de postgresql con `psql postgres`
 
-Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
+5.  Cambiar la contraseña del usuario que se vaya a usar, en este caso
+    root y de contraseña también root, es recomendable que para un
+    entorno de producción no se utilice ni el usuario root ni una
+    contraseña tan débil. El comando sería
+    `ALTER USER root WITH PASSWORD ’password’;`
 
-## Code of Conduct
+6.  Crear la base de datos con el comando `create database retobici;`
 
-In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
+### Generar claves API Mapbox
 
-## Security Vulnerabilities
+Para utilizar el sistema de mapas es necesaria una cuenta y generar las
+claves para el uso del sistema. Una vez creada la cuenta, en la
+dirección https://account.mapbox.com/ se pueden generar las dos claves, tanto la pública como la privada, que se
+usarán más adelante en ambas partes del proyecto.
 
-If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
+### Instalación Back End
 
-## License
+El código se encuentra en este repositorio.
 
-The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
+1.  Si no está instalado el sistema de versiones git, el comando para
+    instalarlo en macOS `brew install git`.
+
+2.  Descargar o clonar el repositorio en el directorio deseado con el
+    comando\
+    `git clone https://gitlab.inf.uva.es/jorplaz/plazalazojorge_2022_backend.git`.
+
+Ahora, con el código del repositorio descargado es necesario configurar
+el entorno del proyecto:
+
+1. Desde la carpeta raíz del proyecto copiar el fichero de entorno de
+    ejemplo con `cp .env.example .env`.
+
+2. Agregar los contenidos al fichero .env
+    ``` 
+    DB_CONNECTION=pgsql
+   DB_HOST=127.0.0.1
+   DB_PORT=5432
+   DB_DATABASE=retobici
+   DB_USERNAME=root
+   DB_PASSWORD=root
+   MAPBOX_TOKEN=clave pública generada en el paso anterior
+    ```
+
+3. Generar la clave de aplicación con el comando
+    `php artisan key:generate`
+
+4. Instalar las dependencias del fichero `composer.yml` con el comando
+    `composer install`
+
+Con la instalación y la configuración completada solo sería necesario
+lanzar el servidor, para ello hay que tener en cuenta de que el proyecto
+se ha desarrollado de manera local, entonces para que se comunique la
+aplicación Android con el Back End, ambos tienen que estar en la misma
+red WiFi.
+
+1.  Obtener la dirección IP del servidor en la red WiFi con el comando
+    `ifconfig`
+
+2.  Lanzar el servidor apuntando a la IP de la red WiFi obtenida en el
+    paso anterior\
+    `php artisan serv –host=192.168.65.9 –port=8000`
+
+3.  Migrar la base de datos para generar la estructura de las tablas y
+    poblar la base de datos de información con el comando
+    `php artisan migrate:fresh –seed`
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index 82a37e400815ec871d3b88cc2f08a67740cec161..594bedfb51d2e9d594418b85e9e645d2f28ec6e1 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -3,6 +3,10 @@
 namespace App\Exceptions;
 
 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
+use Illuminate\Http\JsonResponse;
+use Illuminate\Http\Request;
+use Illuminate\Http\Response;
+use Illuminate\Support\Facades\Log;
 use Throwable;
 
 class Handler extends ExceptionHandler
@@ -44,7 +48,21 @@ class Handler extends ExceptionHandler
     public function register()
     {
         $this->reportable(function (Throwable $e) {
-            //
+            Log::error('exception: '.$e->getTraceAsString());
         });
     }
+
+    /**
+     * @param Request $request
+     * @param Throwable $e
+     * @return Response|JsonResponse|\Symfony\Component\HttpFoundation\Response
+     * @throws Throwable
+     */
+    public function render($request, Throwable $e): Response|JsonResponse|\Symfony\Component\HttpFoundation\Response
+    {
+        if ($e instanceof SactumAuthenticationException) {
+            return \response()->json('This process requires to be authenticated',401);
+        }
+        return parent::render($request, $e);
+    }
 }
diff --git a/app/Exceptions/SactumAuthenticationException.php b/app/Exceptions/SactumAuthenticationException.php
new file mode 100644
index 0000000000000000000000000000000000000000..b0cb5d5a876925be6112748caf847ce26efdbd31
--- /dev/null
+++ b/app/Exceptions/SactumAuthenticationException.php
@@ -0,0 +1,8 @@
+<?php
+
+namespace App\Exceptions;
+
+use Exception;
+use JetBrains\PhpStorm\Pure;
+
+class SactumAuthenticationException extends Exception{}
diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php
new file mode 100644
index 0000000000000000000000000000000000000000..1c4a33756c2386c64ba6b1dfa528af6e846f0cd5
--- /dev/null
+++ b/app/Http/Controllers/AuthController.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Models\User;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Log;
+use Illuminate\Support\Facades\Validator;
+use Laravel\Sanctum\PersonalAccessToken;
+
+class AuthController extends Controller
+{
+    public function login(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            'email' => 'required|string|email',
+            'password' => 'required|string|min:6'
+        ]);
+
+        if ( $validator->fails() || !auth('api')->attempt($validator->validated()) ) {
+            return response()->json(['Invalid credentials'], 401);
+        }
+
+        return response()->json([
+            'token' => auth('api')->user()->createToken('API Token')->plainTextToken,
+            'user' => auth('api')->user()
+        ]);
+    }
+
+    public function logout(Request $request)
+    {
+        $user = UserController::getUserByToken($request);
+        if(1 != $user->tokens()->delete()){
+            return "false";
+        }
+        return "true";
+    }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/BikeController.php b/app/Http/Controllers/BikeController.php
new file mode 100644
index 0000000000000000000000000000000000000000..1baf9862bfffe2c5685a21302b16083fdec473cf
--- /dev/null
+++ b/app/Http/Controllers/BikeController.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Models\Bike;
+use Illuminate\Http\Request;
+
+class BikeController extends Controller
+{
+    public function unlockBike(Bike $bike){
+        return true;
+    }
+
+    public function reserveBike(Bike $bike){
+        return true;
+    }
+}
diff --git a/app/Http/Controllers/MapboxApiClient.php b/app/Http/Controllers/MapboxApiClient.php
new file mode 100644
index 0000000000000000000000000000000000000000..a519e37bfb03ade25b0d4cd3aea2dc964f44c73c
--- /dev/null
+++ b/app/Http/Controllers/MapboxApiClient.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Models\Stop;
+use Illuminate\Support\Facades\Http;
+
+class MapboxApiClient extends Http
+{
+    private String $url;
+    public function __construct(Stop $init, Stop $end)
+    {
+        $lng1 = $init->lng;
+        $lng2 = $end->lng;
+        $lat1 = $init->lat;
+        $lat2 = $end->lat;
+        $coordinates = $lng1.",".$lat1.";".$lng2.",".$lat2;
+        $token = env('MAPBOX_TOKEN', null);
+        $this->url = "https://api.mapbox.com/directions/v5/mapbox/cycling/${coordinates}?alternatives=false&geometries=geojson&overview=full&steps=false&access_token=".$token;
+    }
+    public function buildRequest(){
+        return $this->url;
+    }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/RewardController.php b/app/Http/Controllers/RewardController.php
new file mode 100644
index 0000000000000000000000000000000000000000..2385698eb53522d7c3c3921b434671023af9d632
--- /dev/null
+++ b/app/Http/Controllers/RewardController.php
@@ -0,0 +1,53 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Http\Resources\RewardResource;
+use App\Http\Resources\RewardResourceObtained;
+use App\Models\Reward;
+use App\Models\User;
+use Illuminate\Http\Request;
+
+class RewardController extends Controller
+{
+    public function getAllRewards(){
+        return RewardResource::collection(Reward::all());
+    }
+
+    public function getNotRedeemedRewards(Request $request){
+        $user = UserController::getUserByToken($request);
+        $userR = $user->rewards()->get(['user_reward.reward_id AS result'])->pluck('result');
+        return RewardResource::collection(Reward::all()->whereNotIn('id',$userR));
+    }
+
+    public function getUserRewards(Request $request){
+        $user = UserController::getUserByToken($request);
+        return RewardResourceObtained::collection($user->rewards()->orderByPivot('created_at', 'desc')->get());
+    }
+
+    public function obtainReward(Request $request, Reward $reward){
+        $user = UserController::getUserByToken($request);
+        if ($this->checkReward($user,$reward)){
+            $reward->redeemed += 1;
+            $reward->users()->attach($user);
+            $user->points -= $reward->points;
+            $reward->save();
+            $user->save();
+            return new RewardResourceObtained($reward);
+        }
+        return response()->json("Unable to redeem the reward", 500);
+    }
+
+    private function checkReward(User $user, Reward $reward){
+        if ($reward->total_available <= $reward->redeemed){
+            return false;
+        }
+        if ($user->rewards()->find($reward)){
+            return false;
+        }
+        if ($user->points < $reward->points){
+            return false;
+        }
+        return true;
+    }
+}
diff --git a/app/Http/Controllers/RouteController.php b/app/Http/Controllers/RouteController.php
new file mode 100644
index 0000000000000000000000000000000000000000..b75b76fef8085398ef643078c6ecdfeb3514729c
--- /dev/null
+++ b/app/Http/Controllers/RouteController.php
@@ -0,0 +1,79 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Http\Resources\RouteResource;
+use App\Models\Bike;
+use App\Models\ElectricBike;
+use App\Models\Route;
+use App\Models\Stop;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Http;
+use PhpParser\Node\Expr\Cast\Int_;
+
+class RouteController extends Controller
+{
+    public function createRoute(Request $request, Bike $bike){
+        $user = UserController::getUserByToken($request);
+        $route = new Route;
+        $route->user_id = $user->id;
+        $route->initial_stop_id = $bike->stop()->first()->id;
+        $route->bike_id = $bike->id;
+        $route->save();
+        //Remove any user reservation
+        $reservation = $user->reservations()->first();
+        $reservation?->delete();
+        //Free the bike from the Stop
+        $bike->stop_id = null;
+        $bike->save();
+
+        return new RouteResource($route);
+    }
+
+    public function finishRoute(Request $request){
+        $route = Route::find($request->id);
+        if($request->missing(['duration', 'final_stop'])){
+            return false;
+        }
+
+        $initial_stop = Stop::find($route->initial_stop_id);
+        $final_stop = Stop::find($request->final_stop);
+        $mapboxClient = new MapboxApiClient($initial_stop,$final_stop);
+        $url = $mapboxClient->buildRequest();
+        $response = Http::get($url);
+        $mapbox_response = $response->json();
+        $distance = $response->json('routes')[0]['distance'];
+        $estimated_duration = $response->json('routes')[0]['duration'];
+
+        $route->final_stop_id = intval($request->final_stop);
+        $route->duration = intval($request->duration);
+        $route->mapbox_response = $mapbox_response;
+        $route->distance = intval($distance);
+        $route->estimated_duration = intval($estimated_duration);
+        $route->points = $this->calculatePoints($route);
+        $route->save();
+
+        $user = UserController::getUserByToken($request);
+        $user->points += $route->points;
+        $user->save();
+
+        $bike = $route->bike()->first();
+        $bike->stop_id = $route->final_stop_id;
+        $bike->save();
+
+        return new RouteResource($route);
+    }
+
+    public static function calculatePoints($route): Int{
+        if ($route->distance<=0) {
+            return 0;
+        }
+        $points = 50+(($route->distance*10)/100)-(($route->duration*5)/60);
+        if ($points<0) {
+            return 0;
+        }
+        else {
+            return $points;
+        }
+    }
+}
diff --git a/app/Http/Controllers/StopController.php b/app/Http/Controllers/StopController.php
new file mode 100644
index 0000000000000000000000000000000000000000..1d8f149a401a7e40cbd5f31977e192a6599b20a5
--- /dev/null
+++ b/app/Http/Controllers/StopController.php
@@ -0,0 +1,61 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Http\Resources\BikeResource;
+use App\Http\Resources\StopResource;
+use App\Models\Bike;
+use App\Models\ElectricBike;
+use App\Models\Reservation;
+use App\Models\Stop;
+use Illuminate\Http\JsonResponse;
+use Illuminate\Http\Request;
+
+class StopController extends Controller
+{
+    public function getAllStops(){
+        return StopResource::collection(Stop::all());
+    }
+
+    public function unlockBike(Request $request, Bike $bike){
+        $user = UserController::getUserByToken($request);
+        $stop = $bike->stop()->first();
+        $type = $bike->bikeable_type;
+        $bikes = $stop->bikes()->get()->where('bikeable_type', '=', $type);
+        $reservation = $user->reservations()->first();
+        if ($type=='App\Models\ElectricBike'){
+            $typable = 'electric';
+        }else{
+            $typable = 'pedal';
+        }
+        if (($reservation!=null && $reservation->bike_type==$typable) || $stop->check_availability_bikes($type)){
+            return new BikeResource($bikes->first());
+        }else{
+            return response()->json("No bikes available", 500);
+        }
+    }
+
+    public function lockBike(Stop $stop){
+        if ($stop->total_spaces>0){
+            return new StopResource($stop);
+        }
+        else{
+            return "No space available";
+        }
+    }
+
+    public function reserveBike(Request $request, Stop $stop, String $type){
+        if ($stop->check_availability_bikes($type)){
+            $user = UserController::getUserByToken($request);
+            $reservation = new Reservation();
+            $reservation->user_id = $user->id;
+            $reservation->stop_id = $stop->id;
+            $reservation->bike_type = $type;
+            $reservation->save();
+            return new StopResource($stop);
+        }
+        else{
+            return response()->json("No bikes available for reservation", 500);
+        }
+    }
+}
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
new file mode 100644
index 0000000000000000000000000000000000000000..90d8a6f49dfa494a14bea477d25564758077830e
--- /dev/null
+++ b/app/Http/Controllers/UserController.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Models\User;
+use Illuminate\Http\Request;
+use Laravel\Sanctum\PersonalAccessToken;
+
+class UserController extends Controller
+{
+    public static function getUserByToken(Request $request):User|null
+    {
+        $token = PersonalAccessToken::findToken($request->bearerToken());
+        return ($token != null) ? $token->tokenable : null;
+    }
+}
diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php
index 704089a7fe757c137d99241b758c912d8391e19d..d9dcc9249a79dff706971403f1b2bad205fbe237 100644
--- a/app/Http/Middleware/Authenticate.php
+++ b/app/Http/Middleware/Authenticate.php
@@ -2,20 +2,16 @@
 
 namespace App\Http\Middleware;
 
+use App\Exceptions\SactumAuthenticationException;
 use Illuminate\Auth\Middleware\Authenticate as Middleware;
 
 class Authenticate extends Middleware
 {
     /**
-     * Get the path the user should be redirected to when they are not authenticated.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return string|null
+     * @throws SactumAuthenticationException
      */
-    protected function redirectTo($request)
+    protected function unauthenticated($request, array $guards)
     {
-        if (! $request->expectsJson()) {
-            return route('login');
-        }
+        throw new SactumAuthenticationException("To access this endpoint you need to be authenticated",401);
     }
 }
diff --git a/app/Http/Resources/BikeResource.php b/app/Http/Resources/BikeResource.php
new file mode 100644
index 0000000000000000000000000000000000000000..ac1068f3bbace1a8409f796fa5a773b0f55d516a
--- /dev/null
+++ b/app/Http/Resources/BikeResource.php
@@ -0,0 +1,34 @@
+<?php
+
+namespace App\Http\Resources;
+
+use Illuminate\Http\Resources\Json\JsonResource;
+
+class BikeResource extends JsonResource
+{
+    /**
+     * Transform the resource into an array.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
+     */
+    public function toArray($request)
+    {
+        if ($this->bikeable_type == "App\\Models\\ElectricBike"){
+            $battery = $this->bikeable->battery;
+            $resource = [
+                'bike_id' => $this->id,
+                'unlocked' => $this->unlocked,
+                'battery' => $battery
+            ];
+        }
+        else{
+            $resource = [
+                'bike_id' => $this->id,
+                'unlocked' => $this->unlocked,
+            ];
+        }
+
+        return $resource;
+    }
+}
diff --git a/app/Http/Resources/RewardResource.php b/app/Http/Resources/RewardResource.php
new file mode 100644
index 0000000000000000000000000000000000000000..0b5c2eca7b3a447b8826a814dddd498940b919b1
--- /dev/null
+++ b/app/Http/Resources/RewardResource.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Http\Resources;
+
+use Illuminate\Http\Resources\Json\JsonResource;
+
+class RewardResource extends JsonResource
+{
+    /**
+     * Transform the resource into an array.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
+     */
+    public function toArray($request)
+    {
+        return [
+            "id"=> $this->id,
+            "title"=> $this->name,
+            "description"=> $this->description,
+            "points"=> $this->points,
+            "image" => $this->image,
+        ];
+    }
+}
diff --git a/app/Http/Resources/RewardResourceObtained.php b/app/Http/Resources/RewardResourceObtained.php
new file mode 100644
index 0000000000000000000000000000000000000000..4beaa7fd82495d758bc013f4b4ad2a0cc6be6306
--- /dev/null
+++ b/app/Http/Resources/RewardResourceObtained.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace App\Http\Resources;
+
+use Illuminate\Http\Resources\Json\JsonResource;
+
+class RewardResourceObtained extends JsonResource
+{
+    /**
+     * Transform the resource into an array.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
+     */
+    public function toArray($request)
+    {
+        return [
+            "id"=> $this->id,
+            "title"=> $this->name,
+            "description"=> $this->description,
+            "points"=> $this->points,
+            "image" => $this->image,
+            "obtained" => true,
+        ];
+    }
+}
diff --git a/app/Http/Resources/RouteResource.php b/app/Http/Resources/RouteResource.php
new file mode 100644
index 0000000000000000000000000000000000000000..ab74d0556540e4b18db48d3137df387da810063d
--- /dev/null
+++ b/app/Http/Resources/RouteResource.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace App\Http\Resources;
+
+use Illuminate\Http\Resources\Json\JsonResource;
+
+class RouteResource extends JsonResource
+{
+    /**
+     * Transform the resource into an array.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
+     */
+    public function toArray($request)
+    {
+        return [
+            'id' => $this->id,
+            'user_id' => $this->user_id,
+            'bike' => new BikeResource($this->bike()->first()),
+            'initial_stop_id' => $this->initial_stop_id,
+            'final_stop_id' => $this->final_stop_id,
+            'distance' => $this->distance,
+            'duration' => $this->duration,
+            'points' => $this->points,
+        ];
+    }
+}
diff --git a/app/Http/Resources/StopResource.php b/app/Http/Resources/StopResource.php
new file mode 100644
index 0000000000000000000000000000000000000000..22311eafd43c4684032bd9e02db6526f5bbb82aa
--- /dev/null
+++ b/app/Http/Resources/StopResource.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace App\Http\Resources;
+
+use Illuminate\Http\Resources\Json\JsonResource;
+
+class StopResource extends JsonResource
+{
+    /**
+     * Transform the resource into an array.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
+     */
+    public function toArray($request)
+    {
+        return [
+            'id' => $this->id,
+            'lng' => $this->lng,
+            'lat' => $this->lat,
+            'address' => $this->address,
+            'totalSpaces' => $this->total_spaces,
+            'reserved_pedal_bikes' => $this->reserved_pedal_bikes(),
+            'reserved_electric_bikes' => $this->reserved_electric_bikes(),
+            'bikes' => BikeResource::collection($this->bikes()->get()),
+        ];
+    }
+}
diff --git a/app/Models/Bike.php b/app/Models/Bike.php
index 05c406f1ad5065fdd508355e34404aa34f5746ac..75a3e695eb5876248c169e564045b74e386d032e 100644
--- a/app/Models/Bike.php
+++ b/app/Models/Bike.php
@@ -6,17 +6,25 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 use Illuminate\Database\Eloquent\Relations\HasMany;
+use Nanigans\SingleTableInheritance\SingleTableInheritanceTrait;
 
 /**
  * @method static create(array $array)
+ * @method static find(int $int)
+ * @property mixed $id
+ * @property mixed $bikeable_type
+ * @property mixed|null $stop_id
  */
 class Bike extends Model
 {
     use HasFactory;
 
+    protected $table = "bikes";
+
     protected $fillable = [
         'stop_id',
         'unlocked',
+        'type'
     ];
 
     public function stop(): BelongsTo{
@@ -26,4 +34,8 @@ class Bike extends Model
     public function routes(): HasMany{
         return $this->hasMany(Route::class);
     }
+
+    public function bikeable(){
+        return $this->morphTo();
+    }
 }
diff --git a/app/Models/ElectricBike.php b/app/Models/ElectricBike.php
index 8991516c9ecc90fa3e9b6aee3eec9e8241a4c42e..de5833eb74cae00762939dcfd6d5ce0b2b33995f 100644
--- a/app/Models/ElectricBike.php
+++ b/app/Models/ElectricBike.php
@@ -14,4 +14,8 @@ class ElectricBike extends Bike
         'id',
         'battery',
     ];
+
+    public function bike(){
+        return $this->morphOne(Bike::class, 'bikeable');
+    }
 }
diff --git a/app/Models/Reservation.php b/app/Models/Reservation.php
new file mode 100644
index 0000000000000000000000000000000000000000..f74a1b508f74766b25bb2dc216feffa59551232c
--- /dev/null
+++ b/app/Models/Reservation.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+
+/**
+ * @property mixed $user_id
+ * @property mixed $stop_id
+ * @property mixed|String $bike_type
+ */
+class Reservation extends Model
+{
+    use HasFactory;
+
+    public function user(): BelongsTo{
+        return $this->belongsTo(Route::class);
+    }
+
+    public function stop(): BelongsTo{
+        return $this->belongsTo(Stop::class);
+    }
+}
diff --git a/app/Models/Reward.php b/app/Models/Reward.php
index 3b40b1923ef096321fe69d667b3787dc7775a995..e108eb03c19a837366e856ff345948d05d082114 100644
--- a/app/Models/Reward.php
+++ b/app/Models/Reward.php
@@ -8,6 +8,9 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
 
 /**
  * @method static create(array $array)
+ * @property mixed $redeemed
+ * @property mixed $total_available
+ * @property mixed $points
  */
 class Reward extends Model
 {
@@ -18,6 +21,10 @@ class Reward extends Model
         'description',
         'user_id',
         'reward_id',
+        'points',
+        'total_available',
+        'image',
+        'redeemed',
     ];
 
     public function users(): BelongsToMany{
diff --git a/app/Models/Route.php b/app/Models/Route.php
index 987300d4f49784fd77de0ebeaee262d4367febb0..7a79dedb0fc453a7b97252880bf03cd5b32947f0 100644
--- a/app/Models/Route.php
+++ b/app/Models/Route.php
@@ -6,6 +6,14 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
+/**
+ * @property mixed $user_id
+ * @property \Illuminate\Database\Eloquent\HigherOrderBuilderProxy|mixed $initial_stop_id
+ * @property mixed $bike_id
+ * @property int|mixed $distance
+ * @property int|mixed $duration
+ * @method static find(mixed $id)
+ */
 class Route extends Model
 {
     use HasFactory;
@@ -17,6 +25,7 @@ class Route extends Model
         "bike_id",
         "distance",
         "duration",
+        "estimated_duration",
         "points",
     ];
 
diff --git a/app/Models/Stop.php b/app/Models/Stop.php
index 2a256761eadb23783b69fb544495495482c5101b..0b74cb94dd50c52539232c92e15544ce4857c2e6 100644
--- a/app/Models/Stop.php
+++ b/app/Models/Stop.php
@@ -5,9 +5,16 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\HasMany;
+use phpDocumentor\Reflection\Types\Boolean;
+use PhpParser\Node\Expr\Cast\Int_;
 
 /**
  * @method static create(array $array)
+ * @method static find($initial_stop_id)
+ * @property mixed $lng
+ * @property mixed $lat
+ * @property mixed $total_spaces
+ * @property mixed $id
  */
 class Stop extends Model
 {
@@ -34,4 +41,27 @@ class Stop extends Model
     public function routesEnd(): HasMany{
         return $this->hasMany(Route::class, "final_stop_id");
     }
+
+    public function reservations(): HasMany{
+        return $this->hasMany(Reservation::class);
+    }
+
+    public function reserved_pedal_bikes(): int{
+        return $this->reservations()->where('bike_type', '=', 'pedal')->count();
+    }
+    public function reserved_electric_bikes(): int{
+        return $this->reservations()->where('bike_type', '=', 'electric')->count();
+    }
+
+    public function check_availability_bikes(String $type): bool{
+        $available = false;
+        if ($type=="pedal" || $type=="App\Models\Bike"){
+            $bikeCount = $this->bikes()->where('bikeable_type', '=', 'App\Models\Bike')->count();
+            $available = $bikeCount > $this->reserved_pedal_bikes();
+        }else if ($type=="electric" || $type=="App\Models\ElectricBike"){
+            $bikeCount = $this->bikes()->where('bikeable_type', '=', 'App\Models\ElectricBike')->count();
+            $available = $bikeCount > $this->reserved_electric_bikes();
+        }
+        return $available;
+    }
 }
diff --git a/app/Models/User.php b/app/Models/User.php
index aea9982747212ebf54344dcd3e3e63624f17e195..4bb40e927eb9fc2a669c3869e7dd01f70411f5b8 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -12,6 +12,10 @@ use Laravel\Sanctum\HasApiTokens;
 
 /**
  * @method static create(string[] $array)
+ * @method static find(int $id)
+ * @method static where(string $string, mixed $email)
+ * @property mixed $points
+ * @property mixed $id
  */
 class User extends Authenticatable
 {
@@ -54,4 +58,8 @@ class User extends Authenticatable
     public function rewards(): BelongsToMany{
         return $this->belongsToMany(Reward::class, 'user_reward')->withTimestamps();
     }
+
+    public function reservations(): HasMany{
+        return $this->hasMany(Reservation::class);
+    }
 }
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index ee8ca5bcd8f77d219f29529a9163587235c545d5..c29e18286d9a57da7287f04c72c800e2915db46e 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -2,6 +2,7 @@
 
 namespace App\Providers;
 
+use Illuminate\Http\Resources\Json\JsonResource;
 use Illuminate\Support\ServiceProvider;
 
 class AppServiceProvider extends ServiceProvider
@@ -21,8 +22,11 @@ class AppServiceProvider extends ServiceProvider
      *
      * @return void
      */
-    public function boot()
+    public function boot(\Illuminate\Http\Request $request)
     {
-        //
+        if (!empty( env('NGROK_URL') ) && $request->server->has('HTTP_X_ORIGINAL_HOST')) {
+            $this->app['url']->forceRootUrl(env('NGROK_URL'));
+        }
+        JsonResource::withoutWrapping();
     }
 }
diff --git a/composer.json b/composer.json
index 164c94bdd7dbe07d31942c7d1279e91f8aba9ab0..e112bb19fe10252a0ccde03203a2e9dcf77183fb 100644
--- a/composer.json
+++ b/composer.json
@@ -8,8 +8,9 @@
         "php": "^8.0.2",
         "guzzlehttp/guzzle": "^7.2",
         "laravel/framework": "^9.11",
-        "laravel/sanctum": "^2.14.1",
-        "laravel/tinker": "^2.7"
+        "laravel/sanctum": "^2.15",
+        "laravel/tinker": "^2.7",
+        "nanigans/single-table-inheritance": "~1.0"
     },
     "require-dev": {
         "fakerphp/faker": "^1.9.1",
diff --git a/composer.lock b/composer.lock
index 5d01821b24868d1bc3e6d01977af95e0f33629e5..9ba8178b78f7ec534af1025cac4653c90b15c571 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "1abc7822bd9f28e9a62986817bf04f76",
+    "content-hash": "a6074d6cbd7b2a35b7d18370d948483f",
     "packages": [
         {
             "name": "brick/math",
@@ -895,16 +895,16 @@
         },
         {
             "name": "laravel/framework",
-            "version": "v9.13.0",
+            "version": "v9.17.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/framework.git",
-                "reference": "87b6cc8bc41d1cf85c7c1401cddde8570a3b95bb"
+                "reference": "091e287678ac723c591509ca6374e4ded4a99b1c"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/framework/zipball/87b6cc8bc41d1cf85c7c1401cddde8570a3b95bb",
-                "reference": "87b6cc8bc41d1cf85c7c1401cddde8570a3b95bb",
+                "url": "https://api.github.com/repos/laravel/framework/zipball/091e287678ac723c591509ca6374e4ded4a99b1c",
+                "reference": "091e287678ac723c591509ca6374e4ded4a99b1c",
                 "shasum": ""
             },
             "require": {
@@ -1070,7 +1070,7 @@
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
             },
-            "time": "2022-05-17T14:07:43+00:00"
+            "time": "2022-06-07T15:09:32+00:00"
         },
         {
             "name": "laravel/sanctum",
@@ -1702,6 +1702,67 @@
             ],
             "time": "2022-05-10T09:36:00+00:00"
         },
+        {
+            "name": "nanigans/single-table-inheritance",
+            "version": "v1.0.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/jonspalmer/single-table-inheritance.git",
+                "reference": "5fd1dd86ddc5ab66bf9d1260b8de1e58ac5826ff"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/jonspalmer/single-table-inheritance/zipball/5fd1dd86ddc5ab66bf9d1260b8de1e58ac5826ff",
+                "reference": "5fd1dd86ddc5ab66bf9d1260b8de1e58ac5826ff",
+                "shasum": ""
+            },
+            "require": {
+                "illuminate/database": ">= 5.2",
+                "illuminate/support": ">= 5.2",
+                "php": ">= 7.2"
+            },
+            "require-dev": {
+                "mockery/mockery": "~1.0",
+                "orchestra/database": "3.8.*|4.*|5.*|6.*",
+                "orchestra/testbench": "3.8.*|4.*|5.*|6.*",
+                "phpunit/phpunit": "~8.0|~9.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-main": "1.1.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Nanigans\\SingleTableInheritance\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jon Palmer",
+                    "email": "328224+jonspalmer@users.noreply.github.com"
+                }
+            ],
+            "description": "Single Table Inheritance Trait",
+            "keywords": [
+                "eloquent",
+                "inheritance",
+                "laravel",
+                "model",
+                "single",
+                "table"
+            ],
+            "support": {
+                "issues": "https://github.com/jonspalmer/single-table-inheritance/issues",
+                "source": "https://github.com/jonspalmer/single-table-inheritance/tree/v1.0.0"
+            },
+            "time": "2021-04-17T13:10:00+00:00"
+        },
         {
             "name": "nesbot/carbon",
             "version": "2.58.0",
diff --git a/config/auth.php b/config/auth.php
index d8c6cee7c19c410449b5b9458bde053ae8f5bda0..d819ad65137efa3a6057771685e0dc020d8bbc19 100644
--- a/config/auth.php
+++ b/config/auth.php
@@ -14,7 +14,7 @@ return [
     */
 
     'defaults' => [
-        'guard' => 'web',
+        'guard' => 'api',
         'passwords' => 'users',
     ],
 
@@ -40,6 +40,10 @@ return [
             'driver' => 'session',
             'provider' => 'users',
         ],
+        'api' => [
+            'driver' => 'session',
+            'provider' => 'users',
+        ],
     ],
 
     /*
diff --git a/config/sanctum.php b/config/sanctum.php
index 529cfdc9916c1bd990016e2d8789895873908548..0b60dde1bc0f352744b4810d086b1c32cfc61b5f 100644
--- a/config/sanctum.php
+++ b/config/sanctum.php
@@ -33,7 +33,7 @@ return [
     |
     */
 
-    'guard' => ['web'],
+    'guard' => ['api'],
 
     /*
     |--------------------------------------------------------------------------
diff --git a/database/migrations/2022_06_13_151027_create_bikes_table.php b/database/migrations/2022_06_13_151027_create_bikes_table.php
index 705aadf3aab4c15459a871baf8f83029d9027fd8..6e167202085fddbf2395a98a2fc6916f4ea3dea3 100644
--- a/database/migrations/2022_06_13_151027_create_bikes_table.php
+++ b/database/migrations/2022_06_13_151027_create_bikes_table.php
@@ -16,10 +16,13 @@ return new class extends Migration
         Schema::create('bikes', function (Blueprint $table) {
             $table->id();
             $table->foreignId('stop_id')
+                ->nullable()
                 ->index()
                 ->constrained()
                 ->cascadeOnUpdate();
             $table->boolean('unlocked');
+            $table->unsignedBigInteger('bikeable_id');
+            $table->string('bikeable_type');
             $table->timestamps();
         });
     }
diff --git a/database/migrations/2022_06_13_153838_create_electric_bikes_table.php b/database/migrations/2022_06_13_153838_create_electric_bikes_table.php
index db6b5b73b5caf8e379b40e3ae2d58610f49de036..0946573b306638e14a2e7c05f1818f5538c05ff1 100644
--- a/database/migrations/2022_06_13_153838_create_electric_bikes_table.php
+++ b/database/migrations/2022_06_13_153838_create_electric_bikes_table.php
@@ -17,8 +17,7 @@ return new class extends Migration
             $table->id();
             $table->integer('battery');
             $table->timestamps();
-
-            $table->foreign('id')->references('id')->on('bikes');
+            //$table->foreign('id')->references('id')->on('bikes');
         });
     }
 
diff --git a/database/migrations/2022_06_14_151011_create_routes_table.php b/database/migrations/2022_06_14_151011_create_routes_table.php
index 51d6e35c0c2649c5fa6426286baeef6404e100b9..f73d946e489367cdd01532b1e944b6d90f3dbbba 100644
--- a/database/migrations/2022_06_14_151011_create_routes_table.php
+++ b/database/migrations/2022_06_14_151011_create_routes_table.php
@@ -48,6 +48,8 @@ return new class extends Migration
                 ->nullable();
             $table->integer('duration')
                 ->nullable();
+            $table->integer('estimated_duration')
+                ->nullable();
             $table->integer('points')
                 ->nullable();
 
diff --git a/database/migrations/2022_06_15_144408_create_rewards_table.php b/database/migrations/2022_06_15_144408_create_rewards_table.php
index deebdc13d82e5969780f3d6271f280245a308ef3..485b82c633f4ad2315ba667a8f910e2f49592e1b 100644
--- a/database/migrations/2022_06_15_144408_create_rewards_table.php
+++ b/database/migrations/2022_06_15_144408_create_rewards_table.php
@@ -19,6 +19,7 @@ return new class extends Migration
             $table->string('description');
             $table->integer('points');
             $table->integer('total_available');
+            $table->integer('redeemed')->default(0);
             $table->string('image')->nullable();
             $table->timestamps();
         });
diff --git a/database/migrations/2022_06_20_140941_add_points_field_on_users_table.php b/database/migrations/2022_06_20_140941_add_points_field_on_users_table.php
new file mode 100644
index 0000000000000000000000000000000000000000..49618aff91441215939f905f83595377f39e1734
--- /dev/null
+++ b/database/migrations/2022_06_20_140941_add_points_field_on_users_table.php
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('users', function (Blueprint $table){
+           $table->integer('points')->after('password')->default(0);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('users', function (Blueprint $table){
+            $table->dropColumn('points');
+        });
+    }
+};
diff --git a/database/migrations/2022_06_26_185339_create_reservations_table.php b/database/migrations/2022_06_26_185339_create_reservations_table.php
new file mode 100644
index 0000000000000000000000000000000000000000..e34ab1bce27cdc032d69804ee0ee8f278960ee5e
--- /dev/null
+++ b/database/migrations/2022_06_26_185339_create_reservations_table.php
@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('reservations', function (Blueprint $table) {
+            $table->id();
+            $table->foreignId('user_id');
+            $table->foreignId('stop_id');
+            $table->string('bike_type');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('reservations');
+    }
+};
diff --git a/database/seeders/BikeSeeder.php b/database/seeders/BikeSeeder.php
index 22543e813c4b525d15a0c86a0ebe286d7772b4ad..b638f24c1af6e24f60e82ec01462073a20014f77 100644
--- a/database/seeders/BikeSeeder.php
+++ b/database/seeders/BikeSeeder.php
@@ -18,29 +18,36 @@ class BikeSeeder extends Seeder
     {
         $bike = Bike::create([
             'stop_id' => 1,
-            'unlocked' => false
+            'unlocked' => false,
+            'bikeable_id' => 1,
+            'bikeable_type' => 'App\Models\ElectricBike',
         ]);
         ElectricBike::create([
-            'id' => $bike->id,
             'battery' => 60
         ]);
         Bike::create([
             'stop_id' => 1,
-            'unlocked' => false
+            'unlocked' => false,
+            'bikeable_id' => 2,
+            'bikeable_type' => 'App\Models\Bike',
         ]);
 
         $bike = Bike::create([
             'stop_id' => 2,
-            'unlocked' => false
+            'unlocked' => false,
+            'bikeable_id' => 2,
+            'bikeable_type' => 'App\Models\ElectricBike',
         ]);
         ElectricBike::create([
-            'id' => $bike->id,
             'battery' => 70
         ]);
 
         Bike::create([
             'stop_id' => 3,
-            'unlocked' => false
+            'unlocked' => false,
+            'bikeable_id' => 4,
+            'bikeable_type' => 'App\Models\Bike',
         ]);
+
     }
 }
diff --git a/database/seeders/RewardSeeder.php b/database/seeders/RewardSeeder.php
index 54727890906059adbb61c5bb1d395b618cfb5ee2..a54e2ea27c5573ac277af25e67d5768b1c7f5aa6 100644
--- a/database/seeders/RewardSeeder.php
+++ b/database/seeders/RewardSeeder.php
@@ -16,36 +16,41 @@ class RewardSeeder extends Seeder
     public function run()
     {
         $reward = Reward::create([
-            'name' => 'Reward 1',
+            'name' => 'Visita Guiada de Valladolid',
             'description' => 'A short description',
             'points' => 100,
-            'total_available' => 5
+            'total_available' => 5,
+            "image"=> "https://images.unsplash.com/photo-1591544940847-e8c860a9464e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1974&q=80"
         ]);
         $reward->users()->sync([1,2]);
         $reward = Reward::create([
-            'name' => 'Reward 2',
+            'name' => 'Restaurante Merinos',
             'description' => 'A short description 2',
             'points' => 200,
-            'total_available' => 2
+            'total_available' => 2,
+            "image"=> "https://images.unsplash.com/photo-1621841957884-1210fe19d66d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2340&q=80"
         ]);
         $reward->users()->sync([1]);
         Reward::create([
-            'name' => 'Reward 3',
+            'name' => 'Bar El Corcho',
             'description' => 'A short description 3',
             'points' => 1000,
-            'total_available' => 1
+            'total_available' => 1,
+            "image" => "https://images.unsplash.com/photo-1565599837634-134bc3aadce8?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1335&q=80"
         ]);
         Reward::create([
-            'name' => 'Reward 4',
+            'name' => 'Museo de Escultura de Valladolid',
             'description' => 'A short description 4',
             'points' => 4,
-            'total_available' => 10
+            'total_available' => 10,
+            'image' => 'https://images.unsplash.com/photo-1617257118084-339d30c49b02?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2340&q=80'
         ]);
         Reward::create([
-            'name' => 'Reward 5',
+            'name' => 'Sesión fotográfica profesional',
             'description' => 'A short description 5',
             'points' => 500,
-            'total_available' => 5
+            'total_available' => 5,
+            "image"=> "https://images.unsplash.com/photo-1655219282218-6a4a8d91a699?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2340&q=80"
         ]);
     }
 }
diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php
index 53bc2192f850407e3505cc0871960cb70735c872..81d01bf5cbe65c87ad5464532a5b5ff92cf91205 100644
--- a/database/seeders/UserSeeder.php
+++ b/database/seeders/UserSeeder.php
@@ -18,7 +18,8 @@ class UserSeeder extends Seeder
         User::create([
             'name' => 'Jorge',
             'email' => 'jorge@uva.es',
-            'password' => '12345678'
+            'password' => bcrypt('123456'),
+            'points' => 1000
         ]);
         User::create([
             'name' => 'Mario',
diff --git a/routes/api.php b/routes/api.php
index eb6fa48c25d93f7bf753ba612cd2c7efecea5f4b..2caa2f15cd1795736fce530748db6d06c9f80bf3 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -1,5 +1,9 @@
 <?php
 
+use App\Http\Controllers\AuthController;
+use App\Http\Controllers\RewardController;
+use App\Http\Controllers\RouteController;
+use App\Http\Controllers\StopController;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Route;
 
@@ -17,3 +21,32 @@ use Illuminate\Support\Facades\Route;
 Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
     return $request->user();
 });
+
+Route::post('/login', [AuthController::class, 'login']);
+Route::get('/stops', [StopController::class, 'getAllStops']);
+Route::get('/rewards', [RewardController::class, 'getAllRewards']);
+
+Route::middleware('auth:sanctum')->group(function (){
+
+    Route::post('/stops/{bike}/unlock', [StopController::class, 'unlockBike']);
+    Route::post('/stops/{stop}/reserve/{type}', [StopController::class, 'reserveBike']);
+    Route::get('/stops/{stop}/lock', [StopController::class, 'lockBike']);
+
+    Route::put('/routes/{bike}', [RouteController::class, 'createRoute']);
+    Route::post('/routes/finish', [RouteController::class, 'finishRoute']);
+
+    Route::post('/rewards/{reward}', [RewardController::class, 'obtainReward']);
+    Route::get('/rewards/redeemed', [RewardController::class, 'getUserRewards']);
+    Route::get('/rewards/not/redeemed', [RewardController::class, 'getNotRedeemedRewards']);
+
+    Route::post('/logout', [AuthController::class, 'logout']);
+});
+
+Route::get('/test', function (){
+    $stops = \App\Models\Stop::all();
+    $remove = $stops->first();
+    return $stops->filter(function ($value) use ($remove){
+        return $value!=$remove;
+    });
+});
+
diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php
deleted file mode 100644
index 78ccc21f46a8df7435c5514691eb821a04b28aae..0000000000000000000000000000000000000000
--- a/tests/Feature/ExampleTest.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-namespace Tests\Feature;
-
-use Illuminate\Foundation\Testing\RefreshDatabase;
-use Tests\TestCase;
-
-class ExampleTest extends TestCase
-{
-    /**
-     * A basic test example.
-     *
-     * @return void
-     */
-    public function test_the_application_returns_a_successful_response()
-    {
-        $response = $this->get('/');
-
-        $response->assertStatus(200);
-    }
-}
diff --git a/tests/Feature/UnlockBikeTest.php b/tests/Feature/UnlockBikeTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..7b057d115ee85843536f7b497dde0a62909ab593
--- /dev/null
+++ b/tests/Feature/UnlockBikeTest.php
@@ -0,0 +1,43 @@
+<?php
+
+namespace Tests\Feature;
+
+use App\Models\User;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Testing\Fluent\AssertableJson;
+use Tests\TestCase;
+
+class UnlockBikeTest extends TestCase
+{
+    private const BIKEID = 1;
+    private const ENDPOINT = "/api/stops/1/unlock";
+    private const LOGIN = "/api/login";
+    private const PASSWORD = "123456";
+    private const EMAIL = "jorge@uva.es";
+
+    /**
+     * A basic test example.
+     *
+     * @return void
+     */
+    public function test_check_unlocking_availability_endpoint()
+    {
+        $login = $this->postJson(self::LOGIN, [
+            'email' => self::EMAIL,
+            'password' => self::PASSWORD
+        ]);
+        $token = $login->json('token');
+        $this->withHeaders([
+            'Authorization' => 'Bearer '. $token,
+            'Accept' => 'application/json'
+        ])
+            ->postJson(self::ENDPOINT)
+            ->assertStatus(200)
+            ->assertJson(fn(AssertableJson $json) =>
+            $json
+                ->where('bike_id', self::BIKEID)
+                ->where('unlocked', false)
+                ->etc()
+            );
+    }
+}
diff --git a/tests/Unit/RouteControllerTest.php b/tests/Unit/RouteControllerTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..71b3e13898e7309dac4ce5477cf3e6856260655c
--- /dev/null
+++ b/tests/Unit/RouteControllerTest.php
@@ -0,0 +1,19 @@
+<?php
+
+namespace Tests\Unit;
+
+use App\Http\Controllers\RouteController;
+use App\Models\Route;
+use PHPUnit\Framework\TestCase;
+use function dump;
+
+class RouteControllerTest extends TestCase
+{
+    public function test_calculate_points(){
+        $route = new Route();
+        $route->distance = 1000;
+        $route->duration = 600;
+        $points = RouteController::calculatePoints($route);
+        dump($points);
+    }
+}