express - basic node.js tutorial error Object function router(req, res, next) has no method init -


I'm new to Express and WebStorm and I'm working on a simple tutorial

Believe that I have followed all the instructions correctly and have fixed the type of site on (user vs. users etc.)

Finally, I get the following error:

  / usr / bin / node app.js /home/admin/WebstormProjects/MyNode/app.js:61 users.init (); ^ Type Error: Object Function Router (Rick, Race, Next) {Router Handle (Rake, Race, Next); } There is no way 'init' on the object. & Lt; Anonymous & gt; (Module Js: 456: 26) on the object. Function module.load (module .js: 356: 32) function. Function on module._load (module .js: 312: 12) Module.Ranneman (module .js: 497: 10) at startup (node. Js: 119: 16) at node.js: 902: 3 end process with exit code 8   

me It seems that this express edition is due to incompatibility. I had read the change doctor for Express 4, but I still can not debug this error

You must change the router with exports.init () .init () :

  router.init = function () {users .push (new user ('mat', 'palmail', '818-123-4567')); Users.push (New User ('Joe', 'Plumber', '310-012-9876')); Users.push (New User ('Tom', 'Smith', '415-567-2345')); } / * Get the listing of users * / Router.get ('/', function (Rick, Race) {res.render ('user', {'user': user, 'title': 'user'}); });   

Additionally, node bin \ www instead of node app.js > Be sure to run

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -