简体   繁体   中英

using node.js in making website

I'm starting to use Node.js.I install the latest version of Express"3.4.1, and began to code.but as soon as I try sending parameters except /, I get error.. i have this file index.js

 exports.speakers = function(req, res){
    var myArtwork = [];
    var myArtists = [];

    myArtists = appdata.speakers;
    appdata.speakers.forEach(function(item)
    {
        myArtwork = myArtwork.concat(item.artwork);
});
  res.render('speakers', { 
    title: 'Speakers' ,
    artwork: myArtwork,
    artists: myArtists,
    page: 'artistList'
  });
};

now i want to get the id like in app.js i am using this app.get('/speakers/:speakerid', routes.speakers); but i dont knw how to use exports in index,js.. plz help me for this

You want to know how to get the id using exports? like this?

req.params.speakerid

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM