
Using the express server instance in the nest factoryĬonst app = await NestFactory.create(AppModule, new ExpressAdapter(server)) Īpp.useStaticAssets(join(_dirname, '.', 'public')) Īpp.setBaseViewsDir(join(_dirname, '.', 'views')) Īnd the beginning of my home.pug and message. Creating and setting up the express instanced server 25 Assert 15 Async hooks 15 Asynchronous Context Tracking 93 Buffer 1 C++ addons 1 C++ embedder API 37 Child process 29 Cluster. One of the major noticeable differences between HTML and pug template is that, a pug template does not require the closing of tags.
Node.js pug documentation code#
Pug template engine allows us to write code that can be converted into HTML code.
Node.js pug documentation Offline#
Preferences Offline Data Changelog Guide About Report a bug. In this tutorial, we will explore using an HTML template engine, Pug, which works very well with Node.js. To browse all docs, go to devdocs.io (or press esc ). I've modified the git repo to be able to test the scenario better and believe this is what you are looking for. You're browsing the Node.js documentation. From here you can set up the express server as you normally would and get the desired functionality. With creating and express based application, you can send an express server to the NestFactory to use that server instance instead of having Nest create a plain instance for you. Thank you, I misunderstood your initial question. I've set up a git repo as a working example so you can test it out yourself and see if I need to go in more depth about anything. From what I can tell, you can achieve the same functionality as /layouts/index with just using layout/index so long as layout is a folder in your templates/views directory.
