Question

Template Engines: 1. a project requires to display a page containing some sort of user profile....

Template Engines:

1. a project requires to display a page containing some sort of user profile. With the system eventually having many possible users, how can a template engine help with this?

2. Outside of the user profiles, how could you apply a template engine to other parts?

3. AJAX allows a client to request some information and partially update a page using the data in the response. Template engines do not strictly have to generate an entire HTML page. Can you think of any requests in your project that could make use of a template engine to generate only part of a page, which could then be sent in response to an AJAX request and incorporated into the page already displayed to the user?

Homework Answers

Answer #1

1.Template engine : A template engine enables you to use static template files in your application. At runtime, the template engine replaces variables in a template file with actual values, and transforms the template into an HTML file sent to the client. This approach makes it easier to design an HTML page.

Some popular template engines that work with Express are Pug, Mustache, and EJS.

You can use template engine in your project because in our project there are several part which is repetitive so you can simply use template engine to avoid this.

2.If you can use some of the content in written in user file and want to render it some other part time we can easily use template engine suppose if we want to want to render all username so we can simply store in array and render that array into other section.

3.As we know that when we use ajax then it drive our page without refreshing so basically we use ajax when we work api like post request suppose if want to post some data then we can call ajax through Jquery as it's made our task easier as I have worked on a project survival prediction of a passenger in Titanic ship so first I create a model which predict whether a person survive or not and then design a ui which takes user input then post that into our model which predict whether you would survive or not so for this I use ajax call for posting my data.

If you want implementation so just tell me I can share my github repo with you where you can clone that project and understand all template engine and ajax call part with implementation.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions