About 1,050,000 results
Open links in new tab
  1. node.js - Why is module.exports=router is needed ... - Stack Overflow

    May 10, 2019 · In my node.js server conf file, I set app.use('/user', user.js), which maps /user route to a user.js file. Then I create subrouting in my user.js file to handle my get or post …

  2. Express Tutorial Part 4: Routes and controllers

    4 days ago · First we create routes for a wiki in a module named wiki.js. The code first imports the Express application object, uses it to get a Router object and then adds a couple of routes to it …

  3. Node.js, Module.Exports and Organizing Express.js Routes

    Jun 26, 2012 · Today I wanted to show a practical example of how we can use that knowledge to organize routes in an express.js project. To recap the original post, module.exports is how we …

  4. Routing - Express

    Routing refers to how an application’s endpoints (URIs) respond to client requests. For an introduction to routing, see Basic routing. You define routing using methods of the Express …

  5. How To Modularize Routes With The Express Router

    Dec 4, 2015 · First, we’ll create a separate router instance for our API routes. Simply call express.Router() and export it. // routes/index.js var router = require('express').Router();...

  6. Build Your First Router in Node.js with Express

    Jan 8, 2025 · The express.Router() function in Express.js creates a new router object that can handle requests in a modular and organized way. It serves as a mini-application with …

  7. The Ultimate Guide to Express and ES6 Modules in Node.js

    Nov 30, 2024 · By the end of this article, you will have a solid understanding of how to use Express with ES6 modules to build robust and efficient web applications. Module: A self …

  8. NodeJS + Express part 5: Routes and Controllers - DEV …

    Nov 1, 2021 · To do that we can use an Express Package call Router. Router help to create a list of all your apps routes and associate them to a controller file that contain the implementation …

  9. Importing/exporting the Express router using ES6 import + export ...

    Jul 24, 2016 · The problem is that you are exporting router as named export router, but trying to import it as indexRoute. You should either rename your export: export { router as indexRoute } …

  10. module.exports – How to Export in Node.js and JavaScript

    Apr 25, 2022 · module.exports is an object in a Node.js file that holds the exported values and functions from that module. Declaring a module.exports object in a file specifies the values to …

    Missing:

    • Router

    Must include:

Refresh