HoldUpFjord / Link-Manager

Goal: Create a link manager that can store tabs on a server to be accessed later. 100Devs
2 stars 6 forks source link

Set up the Web API/Create link code #12

Closed TheWoodenMan closed 2 years ago

TheWoodenMan commented 2 years ago

When a new link is submitted to the model it should "grab" (fetch) the header from a site take the title and the link and add all that to mongodb - then refresh.

afaik a basic fetch should be able to do this.

https://stackoverflow.com/questions/71482334/how-can-i-fetch-data-from-a-url-using-javascript

Gonksy commented 2 years ago

Do we want to fetch the title when the link is submitted or when the link is called? If we're fetching the page's title on submission, I believe we would have to store it in the database to call it later. I think both options are fine but storing the title would mean a slight alteration to our tab schema

TheWoodenMan commented 2 years ago

I think it's better to grab the title only when the link is submitted, committing it to the mongodb. I think you're right we'd have to update our schema. (links or tabs haven't had a look yet but will do tomorrow.)

That way we cut down on the number of external fetch requests and any kind of timing issues with waiting for promises while users are active.

TheWoodenMan commented 2 years ago

I'm going to try and do this one today.

TheWoodenMan commented 2 years ago

https://github.com/HoldUpFjord/Link-Manager/pull/20 Solves this