Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

244
Views
How to use routes properly in node.js?

I have app architecture(approximately): (I'm using Express framework)

-routes
-views
-public
-app.js

I tried to use a route in app.js in this way:

var router = require('routes');
app.get('/', router.get);
app.get('/otherRoute', router.get);

File index.js in routes folder:

exports.get = function(req, res) {
   res.render('index',{
       title: "Express",
       a: '<a href="#">Link</a>'
   });
};

I generated only this route '/', '/otherRoute' also generated by index.js of course. I just show the schema.

  • How I can use routes in my app properly? I want, for example, that routes handle by separate file (routes/index.js, routes/about.js, ...). Or will be better to use a one file to handle routes?
  • What app architecture I should have?
  • Hint me, if you know, materials(articles,books) for how I can build node.js apps.

Thank you.

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!