Buatkan solusi aplikasi atau situs web dari URL Shortener Microservice
Build a full stack JavaScript app that is functionally similar to this: https://url-shortener-microservice.freecodecamp.rocks. Working on this project will involve you writing your code using one of the following methods:
Clone this GitHub repo and complete your project locally.
Use a site builder of your choice to complete the project. Be sure to incorporate all the files from our GitHub repo.
HINT: Do not forget to use a body parsing middleware to handle the POST requests. Also, you can use the function dns.lookup(host, cb) from the dns core module to verify a submitted URL.
Tests
Waiting:1. You should provide your own project, not the example URL.
Waiting:2. You can POST a URL to /api/shorturl and get a JSON response with original_url and short_url properties. Here's an example: { original_url : 'https://freeCodeCamp.org', short_url : 1}
Waiting:3. When you visit /api/shorturl/<short_url>, you will be redirected to the original URL.
Waiting:4. If you pass an invalid URL that doesn't follow the valid http://www.example.com format, the JSON response will contain { error: 'invalid url' }
I'll build a URL Shortener Microservice for you. Let me first check the codebase structure and available integrations.
Let me read the Supabase example files to understand how to properly set up the client:
Now I have all the information I need. Let me first create the database migration script to set up the URLs table, then build the full application.
Now let me execute the database migration script to create the URLs table: