Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Express Basics Using Templates with Express What is Template Rendering?

Kevin Ohlsson
Kevin Ohlsson
4,559 Points

Is VUE a templating language?

Hello

Andrew (author in course) mentioned

Pug.js (formerly Jade)

Handlebars.js

EJS (Embedded JavaScript)

... as templating languages.

is VUE another alternative to these?

https://vuejs.org

3 Answers

Balazs Peak
Balazs Peak
46,160 Points

You are getting close.

To put it simple, Vue knows probably everything that Pug knows, plus a lot more. So Vue is a "bigger thing".

More in detail:

Pug is a simple templating framework. With the same .pug file, you can render different HTML pages, which are different based on variables and a couple of other programming features. Pug's purpose is to write less html code. Templating is a very common task, when it comes to web development.

For example, if you have a social media site, you don't want to create a a static HTML page for every user, and store it on your server. You want a profile template, in which you can load the user info from variables (name, picture, favourite books, country ...etc.).

Vue on the other hand has it's own templating feature, plus a lot more. It is a full featured front-end JavaScript framework with many-many more capabilities than Pug.

Vue is comparable to React and Angular. These 3 are the most common front-end JavaScript frameworks.

Kevin Ohlsson
Kevin Ohlsson
4,559 Points

Thank you!

Another question, if you dont mind, what is the difference between Vue and Express?

I head Express is more for backend and Vue is for frontend, and they can be combinded to make it faster to develop websites?

Balazs Peak
Balazs Peak
46,160 Points

Express is a web development framework in the back-end. It can be used together with Vue.js, if you are more ambitious, or with Pug, for more simple projects on front.

The application you develop in Express runs on the web server, and it is primarily responsible for handling the HTTP request and send the responses, and call for all the business logic that happens in between - that is why it can be called a middleware framework. You can make your custom middleware functions in Express, which are responsible for handling the request data and sending the responses based upon them.

react is a front end framework right? node>express etc on backend and angular,vue,react on front? and mongo db in between?

Kevin Gates
Kevin Gates
15,053 Points

Hi Saud Tauqeer :

Vue, React, and Angular are Front-End frameworks. They operate on the client-side (your laptop).

Express is a middleware that operates on a Node.js Backend. Node is a JavaScript based backend. Express makes it easier to talk to client by handling a lot of the foundational code for any website.

MongoDb is a name of a "NoSQL" database (the "Db" is the database portion).

So you can view it like this: A Client requests information about a user from the Server. The server looks up that information from a database. The database returns the results of the server request. The server then responds to the client.

To state it with the frameworks: Your view a website that uses Vue for the design and layout of the Front-End. You request information about a User. The request is sent to the Node Server. Express on the Node Server identifies the request and handles some basic processing. Express will contact the MongoDB database with its query. The MongoDB will respond to the Node Server. Express on Node will send a response back to the client, and Vue on the client's computer will handle processing and showing the information to the end-user.

Alex Vien
Alex Vien
7,615 Points

Templating in React

Does React have templating built in? Can I use React to generate my views rather than Pug or EJS? If so, is there a course that covers generating views in React? Thanks!