Shorten up huge URLs to a small link
Today I created a node app to get generate a small link for a long website link.
How to use:
Request
I am using Hoppscotch to play with my routes. You may use any tools like Hoppscotch, Postman, etc. Here I am creating a POST request to the URL https://ishan-us.herokuapp.com/api/url/shorten
with content type application/json and a Parameter name longUrl with the value of any large URL you want to compress. That’s it!!!
Response
View the response in a JSON format. you can see a response with status 200. The longUrl is the actual site where the user will be redirected, and the shortUrl is your generated small URL.
I automated the workflow of this project with GitHub Actions.
It was my first ever Actions so I was super duper excited. After clicking the Actions option in my repository, the below page appeared
I selected the set up your workflow yourself option to get started.
My Workflow
The name of my Github Actions is Node.js CI
. It runs the following code every time something is pushed on the master branch, or if a pull request is made to the master branch.
npm ci
npm run build --if-present
npm test
After I created my .yml file and ran my workflow, this page displayed after building.
Submission Category:
Wacky Wildcards
Link to Code
Note:
The collaboration to the project is open to all.