- Quick Installation
Create folder mkdir go-activity
in the current directory, create a package.json file. npm init This work can be done by command.
Current directory installs express NPM install Express--save, directory structure such as
And then we started the code.
- Start using Jade at Views/index.jade
extends layoutblock content .content .content-heading .container .content-inner .container .progress .progress-bar-indeterminate . region area: span Xiamen div.row div.col-md-6 label.floating-label (for= ' text_search ', style= ' margin-left:17px ') Enter your keywords input#text_search.form-control div.col-md-2 button.btn.btn-alt.waves-button.waves-effect.waves-light Enquiry .card-wrap .row.row-fix each val, index in activities .col-lg-3.col-md-4.col-sm-6 .card .card-main .card-inner p.card-heading.text-alt= val.title p= val.content . Card-action ul.nav.nav-list.pull-left li a (href= ' javascript:void (0) ') i.fa.fa-thumbs-o-up= val.nbcount li a (href= ' javascript:void (0) ') i.fa.fa-star-o li a (href= ' Javascript:void (0) ') I.fa.fa-comment-o
- Pass the data in the route, there is no database, because I do not ...
var express = require (' Express '); var router = Express. Router ();/* GET home page. */router.get ('/', function (req, res, next) {Res.render (' index ', {title: ' Active ', activities:[{title: ' Play basketball on weekends ', Conten T: ' Student apartment play together, bring the dry food ', nbcount:33}, {title: ' Mahjong three missing one ', content: ' Seaside play Mahjong Hair '}, {title: ' Test One ', Content: ' pi equals how many ... '}, {title: ' Test Two ' (content: ' *********** '}]}); Module.exports = router;
- Look at the results
Simple use of node-------Express