DEV Community

Cover image for Things you should handle while making a web application as a Developer
Kalpesh Dharpure
Kalpesh Dharpure

Posted on

Things you should handle while making a web application as a Developer

As a developer while creating apps, you don't know what will happen in the future if anything goes wrong in Application.
After getting some industry experience as a full stack developer, I noticed some issues after the deployment of web apps.
that I should know before making or deploying web apps in frontend and backend both
Let's see some of the points that I discovered or learned from some of my senior developers.

Error Handling

While creating apps, error handling is one thing that you should handle and must know Especially in server side or backend
You never know what will happen in the future in application , so you should always use the try to catch block in all of APIs or in frontend application where you call your Api's .

Image description

how to use try catch

try {
//your api or anything
}
catch(err) {
//it will throw an error
console.log("error",err)
}

logger in server application

Sometimes your application will get an error or the server will go down. your server should creates logs if any errors occur That will show when the error occurs, on what day and at what time, and which error it is.

example :
error occurs in your server
server will throw an error
logger will catch the error and create file of that day

for node js you can use npm packages

validation

In the front-end application, you must validate inputs or required fields.

For example, a user needs to add a mobile number in the input box, but he adds abcdef instead of 12245555.

Also, the number length must be at least ten numbers .

If he doesn't fit in the above conditions, you should show an alert message or red message that please add a valid mobile number.
You can apply this type of validation to other inputs, such as email. 
Some tips
You can use a regex validator script or any package like formik or others.

but but ...

Image description

note you must also validate data in server side also

default image

For example, you are using a web application and displaying images from an API.

and the user's internet goes down, or a network problem occurs, or the API is unavailable.

The user will get something like this view in the front-end application.

Image description

How to fix this

Normally, we create an img tag like this to display an image.

<img src="your image.jpg" alt="Italian Trulli">

by using javascript or onerror
<img id="currentPhoto" src="SomeImage.jpg" onerror="this.onerror=null; this.src='Default.jpg'" alt="" width="100" height="120">

That's it. There are a lot of things to do  Thanks for reading my post It's my first post, and I hope you enjoyed it.

Image description

Top comments (0)