简体   繁体   中英

What does a MEAN (stack) Node.js app directory look like in comparison to a rails (stack) directory?

This is my first time looking at a Node stack and I'm a little confused about some basic stuff since I learned web development using Ruby on Rails. I understand what a rails directory looks like.

demo/
..../app
......../assets *Javascript, CSS, images, etc*
......../controller *Connect the model with the view*
......../helpers - *model & view assistance code*
......../models - *Database Structure*
......../views - *HTML CSS*
............../layouts *overall application view structure *
..../components
..../config *Server related stuff I only touch when pushing to production*
..../db *schema for database, db relationships defined by the model3*
..../doc
..../lib *Rake tasks, or custom tasks to populate the database*
..../log
..../public *Things I never touch/site map, custom error pages/SEO Stuff*
..../script *Things I never touch*
..../test *Things I never touch*
..../tmp *Things I never touch*
..../vendor *Things I never touch*
README
Rakefile

What does a MEAN directory structure look like in comparison?

It looks however you want it to. It's more of a makeshift stack and not a full framework like rails. The E stands for express which is a popular Node framework. Here is an example of commonly used Express layout:

project/
  controllers/
    comments.js
    index.js
    users.js
  helpers/
    dates.js
  middlewares/
    auth.js
    users.js
  models/
    comment.js
    user.js
  public/
    libs/
    css/
    img/
  views/
    comments/
      comment.jade
    users/
    index.jade
  tests/
    controllers/
    models/
      comment.js
    middlewares/
    integration/
    ui/
  .gitignore
  app.js
  package.json

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