From the course: Vanilla JavaScript: Web Performance Optimization APIs

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Add server timing information

Add server timing information - JavaScript Tutorial

From the course: Vanilla JavaScript: Web Performance Optimization APIs

Start my 1-month free trial

Add server timing information

- [Instructor] The last timing API available in the performance interface is known as the serverTiming API. And because it has server in its name, it means we are getting out of the browser of the client. The whole idea here is that we can also send metrics about the performance of the server to the API, and we need to do that from the server. If you open the project, you will find the same web project that we were working on but now we also have a server.js file that is using Express.js to just set a web server with Node.js, and it's also using a library, known as server-timing, that will let us set metrics and send those metrics to the client. Of course, you can use PHP, .NET, Java or any server side architectural language. The metrics are being sent using http headers. And then the browser will receive those headers and will populate the information within the performance timeline. So let's see this in action. I'm going to start my project, and before that we need to install…

Contents