This package can enhance your website with just one line of code!
Enhance your Node JS application with this one package
Table of contents
Introduction
Recently, while creating a Node JS application, I found the perfect NPM package that would help attract users. Without any further delay, let me show how you can enhance your website with just one line of code
Every website has a 404 not found page. This page is displayed when a user enters a route that does not exist on the server. Here are some examples of such pages
Youtube
Discord
This page is usually where a developer uses his creative mind to create fun looking designs that have a certain engagement with the user. For instance, Google developed the Dino game that was displayed when a user did not have internet access. This increased its engagement and user experience.
Similarly, this blog will tell you how you can increase user engagement with an NPM package for your 404 error page.
The Package
The package I am referring to is called 'one-liner-joke'. This package generates a single line joke that can entertain your users when they land on your 404 page. So let us install this package
Installation and Integration
You can install the package by typing the following command on your terminal
npm install one-liner-joke
Now, we can require the package like so
const jokePackage = require("one-liner-joke");
Usage
The joke can be accessed using the below code
const getRandomJoke = oneLinerJoke.getRandomJoke({
'exclude_tags': ['racist', 'sexist']
});
With the joke stored as a string, you can simply pass this variable to your frontend โ where it will be used in your 404 error page.
Conclusion
That is from this blog ! Thank you for reading and happy coding!