I have a Nextjs React app. Client will send a docx external url to to next api, and expect to get the words count inside the docx. Client can also do the work itself.
Another solution is to return a blob, and client will do the count.
Haven't found any solution for that yet.
Client using next js api:
const docxURL = encodeURIComponent('some_external_url.docx')
const result = await fetch(`/api/words/${docxURL}`, {method: 'GET'})
const wordsCount = (await result.json()).count
Pure Client:
const docxURL = 'some_external_url.docx'
const result = await fetch(docxURL, {method: 'GET', mode: 'no-cors'})
const wordsCount = ...?