Now, in today’s discussion, we’ll delve further and look into the View Engine. Now, in this case i am going to discuss Razor like view engine known as Vash. Now, in order to install the 1st, this time i go ahead and use npm with command prompt as shown below in the screen shot. Now, once that is done it will get updated in the package.json as well.
Now, in the code side, i just need to include the view engine. This time i don’t need to call via require rather in a different way and then i’ll use render keyword to render the view as shown in the below screen shot.
Now, the next thing here is i need to create the views folder as all the views supposed to be in views folder. Now, one point to note here, this is kind of convention which needs to follow. Now, in that folder i’ll create one text file and name it index.vash as shown in the screen shot and then i’ll put some razor like HTML inside
With this i would like wrap this session here, in the next segment, we’ll see more on controllers and service. Till then stay tuned and Happy coding.
1,547 total views, 1 views today