foundersandcoders / express-and-testing-workshop

A Founders and Coders workshop to teach testing an express backend connected to a PSQL DB
MIT License
6 stars 10 forks source link

File structure #1

Open des-des opened 7 years ago

des-des commented 7 years ago

I think the convention more like:

-- server
  |-- models
     |-- ..
  |-- controllers
     |-- some_controller.js
     |-- some_other_controller.js
  |-- router.js
  |-- app.s
-- tests

But I could be wrong here I have not looked at that many express projects..

akinsho commented 7 years ago

I've seen that pattern pattern a few times but in my subjective and not extensive time with express it hasn't seemed like the default folder structure for express apps, also I don't really have enough content to actually warrant that pattern I think

des-des commented 7 years ago

@Akin909 I am not sure I agree with you. Can you give me an example of a project structured like yours?

https://expressjs.com/en/starter/generator.html is prob the best place to start.

  1. I am pretty sure having a test file in root is far more common than having it in a server folder. (in express / hapi / vanilla this seems to be the convention)
  2. I think, if you are doing ssr and not using react, you would normally keep the server in the root of the project.
  3. The convention in express is defo to have a folder called controllers, not routes