Simple use of node-------Express

Source: Internet
Author: User

  1. Quick Installation
      1. Create folder mkdir go-activity

      2. in the current directory, create a package.json file. npm init This work can be done by command.

      3. Current directory installs express NPM install Express--save, directory structure such as

      4. And then we started the code.

  2. 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
  3. 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;
  4. Look at the results

Simple use of node-------Express

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.