2

I would like to know how do you usually organize your application structure when building a NodeJS application using nvst. When I create my app it automatically build up this structure for me: enter image description here

So, the first thing that came to my mind was, where should I put my controllers and how do I connect them with the routes and views?

Also, how can I organize my unit testing logic?

1 Answer 1

0

An NTVS angular app is still just an angular app. The advice in AngularJS application file structure applies.

Going further, General principle: You should be able to find what you're looking for without excessive drilling or scrolling.

Schemes:

  • for smaller apps, folder by type: controller; service; model
  • for larger apps, folder by function: user; cart; search; grid

I lean toward folder by function, as it keeps files that may need to be modified at the same time together.

As for unit tests, I have seen either myfile.test.js or myfile.spec.js sitting right beside myfile.js. If you do not include the test files in the index.js, then they won't be loaded and don't cause a problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.