-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
39 additions
and
45 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
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
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ class CustomApiError extends Error { | |
} | ||
} | ||
|
||
export default CustomApiError | ||
export default CustomApiError; |
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
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
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
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
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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import type { RequestHandler } from 'express'; | ||
import express from 'express'; | ||
import { getAllWidgets, createWidget, getWidget, updateWidget, deleteWidget } from '../controllers/widgets.js'; | ||
import { Router } from 'express'; | ||
import { index, show, create, update, destroy } from '../controllers/widgets.js'; | ||
|
||
const router = express.Router() | ||
const router = Router(); | ||
|
||
// RequestHandler assertion is necessary due to argument being AuthenticatedRequest instead of Request | ||
// TODO: probably a better way to do this | ||
router.route('/') | ||
.get(getAllWidgets as RequestHandler) | ||
.post(createWidget as RequestHandler); | ||
.get(index as RequestHandler) | ||
.post(create as RequestHandler); | ||
|
||
router.route('/:id') | ||
.get(getWidget as RequestHandler) | ||
.put(updateWidget as RequestHandler) | ||
.delete(deleteWidget as RequestHandler); | ||
.get(show as RequestHandler) | ||
.put(update as RequestHandler) | ||
.delete(destroy as RequestHandler); | ||
|
||
export default router; |
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