feat: add short link to create endpoint response
Enhances the link creation API response by including a formatted short link URL Combines protocol, host, and slug to create a complete, ready-to-use short URL
This commit is contained in:
parent
19e18546de
commit
172956b532
1 changed files with 2 additions and 1 deletions
|
|
@ -23,6 +23,7 @@ export default eventHandler(async (event) => {
|
|||
},
|
||||
})
|
||||
setResponseStatus(event, 201)
|
||||
return { link }
|
||||
const shortLink = `${getRequestProtocol(event)}://${getRequestHost(event)}/${link.slug}`
|
||||
return { ...link, shortLink }
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue