![]() ![]() ![]() Background: HD188553, NASA/JPL-Caltechįollowing the parameterized route the guardian. The following code sets up a simple HTTP server with Express.js.Ĭonsole.log(`Server started at port $`) It will be created after the author and license fields are over. The compiled function can be re-used, and. Call that resultant function with your data, and voil, it will return a string of HTML rendered with your data. pug.compile () will compile the Pug source code into a JavaScript function that takes a data object (called locals ) as an argument. If you want some other name, like app.js, you can do the naming here. The general rendering process of Pug is simple. Then you must scale one directory up like extends. Now there is one field called entry point where you can give a name to your main file (. NOTE: The extends will look in your directory for layout.pug, in my case the templates are in the same level,aka the same directory, but if you have the following folder structure like: /public/views/ -layout.pug /main/ -index.pug -about.pug. Pug Options Optional: Compile/Render Options New in v0.2.15 Set compile/render options using the Configuration API. Read more at Changing a Template’s Rendering Engine. Inside /node-project, we will create the package.json file for our Node.js + Express.js application typing the below command.įill the name, version, description and other such fields with your own values. Pug templates used to be called Jade templates and the project was renamed. ![]() Create a working directory for your project, say, /node-project. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |