Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6130821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:54:10+00:00 2026-05-23T16:54:10+00:00

Playing around with Node.js and I really want to keep my file structure organized.

  • 0

Playing around with Node.js and I really want to keep my file structure organized. Normally in a project in another language I would have a structure like this:

  • Node App Directory
    • App.js
    • Controllers
      • UserController.js
      • OtherController.js
    • Models
      • UserModel.js
      • OtherModel.js

The (potential) problem I see is this: I use Mongoose and MongoDB for my database, in order to define a “Model” I need a Mongoose Schema, in order to do that I have to connect to the database with Mongoose in each of the Controllers and Model files.

I know so little about these technologies, this could be lightning quick and never be an issue and I wouldn’t have a clue. Or is this something I should avoid and just shove everything in one (very large) file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:54:11+00:00Added an answer on May 23, 2026 at 4:54 pm

    You don’t need to connect to mongo in every controller/model file. Just do it once in App.js and you’re done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been playing around with node.js, and coming from a Java background, I
Been playing around with node.js and I am developing a file uploading web app
I am playing around with Hadoop and have set up a two node cluster
I have been playing around with the youtube API and node.js, so far I
I've been playing around with node.js (nodejs) for the past few day and it
I have been playing around with declaring objects in XAML. I have these classes
I'm new in Android development and I have the next question/problem. I'm playing around
While playing around with playframework yabe-siena-gae, I noticed a datastore file created for the
Playing around with Google Maps these days, with some directions. I have a map
playing around with a property file i figured that there seems to be a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.