-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
La implementación de la API correctamente documentada en el archivo del proyecto.
- Loading branch information
Showing
8 changed files
with
172 additions
and
0 deletions.
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,28 @@ | ||
import { Controller } from "../controller"; | ||
import Hapi from '@hapi/hapi'; | ||
import { pino } from 'pino'; | ||
import * as deliveryMan from '../handlers/delivery_man.handler' | ||
|
||
|
||
const logger: pino.Logger = Controller.getInstance().getLogger(); | ||
const server: Hapi.Server = Controller.getInstance().getServer(); | ||
|
||
|
||
server.route({ | ||
method: 'PUT', | ||
path: '/deliveryMan', | ||
handler: function(request, h) { deliveryMan.createDeliveryMan(request, h) } | ||
}); | ||
|
||
server.route({ | ||
method: 'POST', | ||
path: '/deliveryMan', | ||
handler: function(request, h) { deliveryMan.updateDeliveryMan(request, h) } | ||
}); | ||
|
||
server.route({ | ||
method: 'DELETE', | ||
path: '/deliveryMan/{id}', | ||
handler: function(request, h) { deliveryMan.deleteDeliveryManByID(request, h) } | ||
}); | ||
|
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,22 @@ | ||
import { Controller } from "../controller"; | ||
import Hapi from '@hapi/hapi'; | ||
import { pino } from 'pino'; | ||
import * as order from '../handlers/order.handler' | ||
|
||
|
||
const logger: pino.Logger = Controller.getInstance().getLogger(); | ||
const server: Hapi.Server = Controller.getInstance().getServer(); | ||
|
||
|
||
server.route({ | ||
method: 'GET', | ||
path: '/order', | ||
handler: function(request, h) { order.getOrderByID(request, h) } | ||
}); | ||
|
||
server.route({ | ||
method: 'PUT', | ||
path: '/order', | ||
handler: function(request, h) { order.createOrder(request, h) } | ||
}); | ||
|
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,40 @@ | ||
import { Controller } from "../controller"; | ||
import Hapi from '@hapi/hapi'; | ||
import { pino } from 'pino'; | ||
import * as product from '../handlers/product.handler' | ||
|
||
|
||
const logger: pino.Logger = Controller.getInstance().getLogger(); | ||
const server: Hapi.Server = Controller.getInstance().getServer(); | ||
|
||
|
||
server.route({ | ||
method: 'GET', | ||
path: '/product', | ||
handler: function(request, h) { product.getAllProducts(request, h) } | ||
}); | ||
|
||
server.route({ | ||
method: 'GET', | ||
path: '/product/{id}', | ||
handler: function(request, h) { product.getProductByID(request, h) } | ||
}); | ||
|
||
server.route({ | ||
method: 'PUT', | ||
path: '/product', | ||
handler: function(request, h) { product.createProduct(request, h) } | ||
}); | ||
|
||
server.route({ | ||
method: 'POST', | ||
path: '/product', | ||
handler: function(request, h) { product.updateProduct(request, h) } | ||
}); | ||
|
||
server.route({ | ||
method: 'DELETE', | ||
path: '/product/{id}', | ||
handler: function(request, h) { product.deleteProductByID(request, h) } | ||
}); | ||
|
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,40 @@ | ||
import { Controller } from "../controller"; | ||
import Hapi from '@hapi/hapi'; | ||
import { pino } from 'pino'; | ||
import * as restaurant from '../handlers/restaurant.handler' | ||
|
||
|
||
const logger: pino.Logger = Controller.getInstance().getLogger(); | ||
const server: Hapi.Server = Controller.getInstance().getServer(); | ||
|
||
|
||
server.route({ | ||
method: 'GET', | ||
path: '/restaurant', | ||
handler: function(request, h) { restaurant.getAllRestaurants(request, h) } | ||
}); | ||
|
||
server.route({ | ||
method: 'GET', | ||
path: '/restaurant/{id}', | ||
handler: function(request, h) { restaurant.getRestaurantByID(request, h) } | ||
}); | ||
|
||
server.route({ | ||
method: 'PUT', | ||
path: '/restaurant', | ||
handler: function(request, h) { restaurant.createRestaurant(request, h) } | ||
}); | ||
|
||
server.route({ | ||
method: 'POST', | ||
path: '/restaurant', | ||
handler: function(request, h) { restaurant.updateRestaurant(request, h) } | ||
}); | ||
|
||
server.route({ | ||
method: 'DELETE', | ||
path: '/restaurant/{id}', | ||
handler: function(request, h) { restaurant.deleteRestaurantByID(request, h) } | ||
}); | ||
|
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,9 @@ | ||
import Hapi from '@hapi/hapi'; | ||
|
||
|
||
export function createDeliveryMan(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|
||
export function updateDeliveryMan(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|
||
export function deleteDeliveryManByID(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|
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,7 @@ | ||
import Hapi from '@hapi/hapi'; | ||
|
||
|
||
export function getOrderByID(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|
||
export function createOrder(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|
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,13 @@ | ||
import Hapi from '@hapi/hapi'; | ||
|
||
|
||
export function getAllProducts(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|
||
export function getProductByID(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|
||
export function createProduct(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|
||
export function updateProduct(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|
||
export function deleteProductByID(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|
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,13 @@ | ||
import Hapi from '@hapi/hapi'; | ||
|
||
|
||
export function getAllRestaurants(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|
||
export function getRestaurantByID(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|
||
export function createRestaurant(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|
||
export function updateRestaurant(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|
||
export function deleteRestaurantByID(request: Hapi.Request, h: Hapi.ResponseToolkit) {} | ||
|