Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Damien Armillon
API Toucan
Commits
045b231a
Commit
045b231a
authored
Feb 10, 2022
by
Inès Yeterian
Browse files
Last toucan url
parent
4d763cb5
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/routes/routesToucan.js
View file @
045b231a
...
...
@@ -106,6 +106,20 @@ router.route("/delete/:id")
});
});
router
.
get
(
'
/dernierToucan
'
,
(
req
,
res
)
=>
{
Toucan
.
find
()
.
sort
({
date
:
-
1
})
.
limit
(
1
)
.
exec
(
function
(
err
,
toucan
)
{
if
(
err
)
{
res
.
send
(
err
);}
else
{
const
id
=
toucan
[
0
].
_id
;
res
.
sendFile
(
path
.
resolve
(
env
.
savedExtensions
[
1
].
path
,
id
+
"
.pdf
"
));
}
});
});
// Renvoie la cover du toucan avec l'id donné
router
.
route
(
"
/img/:id
"
)
.
get
(
celebrate
({
params
:
validId
}),
function
(
req
,
res
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment