![]() Background: HD188553, NASA/JPL-Caltechįollowing the parameterized route the guardian. 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. The following code sets up a simple HTTP server with Express.js.Ĭonsole.log(`Server started at port $`) The general rendering process of Pug is simple. The example below defines block scripts, block content. Providing default content is purely optional, though. Pug blocks can provide default content, if appropriate. In a template, a block is simply a block of Pug that a child template may replace. If you have index.pug file in a folder, you can open terminal there and execute command pug index.pug which should. It will be created after the author and license fields are over. Template inheritance works via the block and extends keywords. pug and compiles to files with extension. ![]() If you want some other name, like app.js, you can do the naming here. ![]() Now there is one field called entry point where you can give a name to your main file (. 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. Create a working directory for your project, say, /node-project. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |