Created
April 7, 2020 09:01
-
-
Save nemrosim/8401397dcb91b984a4ae514cbb0fe090 to your computer and use it in GitHub Desktop.
refactored routes
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
const Route = use('Route'); | |
const { ROUTES, CONTROLLERS } = require('../../constants/routes'); | |
Route | |
.group(() => { | |
Route | |
.resource(ROUTES.ADDRESSES, CONTROLLERS.ADDRESSES) | |
.middleware('auth') | |
.apiOnly(); | |
Route | |
.get(`${ROUTES.ADDRESSES}/current`, `${CONTROLLERS.ADDRESSES}.addressOfCurrentUser`) | |
.middleware('auth') | |
.formats(['json']); | |
Route | |
.get(`${ROUTES.ADDRESSES}/user/:id`, `${CONTROLLERS.ADDRESSES}.findByUserId`) | |
.middleware('auth') | |
.formats(['json']); | |
Route | |
.delete(`${ROUTES.ADDRESSES}/user/:id`, `${CONTROLLERS.ADDRESSES}.deleteByUserId`) | |
.middleware('auth') | |
.formats(['json']); | |
}) | |
.prefix('api/v1/'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment