Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aurelia project setup and folder structure in Visual Studio 2015: what goes in wwwroot?

I want to start playing with Aurelia and MVC 6 Web API with Visual Studio 2015 RC, and I'm using OdeToCode's blog post as a starting point.

I understand the idea behind the new wwwroot folder, but I'm basically confused as to what should or shouldn't put in there.

My initial thought would to install all jspm packages as well as the actual JavaScript source files outside the wwwroot folder, and then copy with gulp everything that's necessary for running while developing or bundle and copy when deploying.

It would look something like this:

enter image description here

But then again, should I place index.html also in the src folder? and config.js? Or am I actually making my life difficult for myself and should just develop from within the wwwroot folder?

It's the jspm packages that confuse me; it feels wrong to have such a large amount of JavaScript files in the wwwroot when I plan on bundling and minifying anyway.

In short: What would be the preferred folder structure for an Aurelia ASP.NET 5 app in Visual Studio 2015?

like image 232
Sergi Papaseit Avatar asked May 08 '15 13:05

Sergi Papaseit


1 Answers

I spent quite some time on this and finally settled on:

  • ApplicationName
    • src
      • Api
        • In here I have an ASP.NET 5 project that provides the api to be consumed by the Aurelia app. You will likely need to turn on CORS to avoid errors.
      • Client.Web
        • In here I started with the Aurelia skeleton navigation app. We changed the dist folder to wwwroot. The jspm_packages folder sits outside the wwwroot and the gulp tasks that come with the skeleton navigation app take care of all the copying to wwwroot as needed.

This approch gave me the following benefits:

  • Clean separation of the api and the client code.
  • Option to deploy the api and client separately.
  • Ability to leverage all of the gulp tasks that come with the skeleton navigation app
  • Clear place to switch over to the Javascript file naming conventions (camelCase)

The drawbacks of this approach:

  • Starting the full app is more difficult. Currently, I have to click "Play" in Visual Studio to start the api, then I have to start gulp watch. This is not too big of a deal because you can mostly leave gulp watch running the entire time you develop.
like image 102
Josh Graham Avatar answered Sep 23 '22 09:09

Josh Graham