All Projects → EEParker → Aspnetcore Vueclimiddleware

EEParker / Aspnetcore Vueclimiddleware

Licence: other
Helpers for building single-page applications on ASP.NET MVC Core using Vue Cli or Quasar Cli.

Projects that are alternatives of or similar to Aspnetcore Vueclimiddleware

Server
The core infrastructure backend (API, database, Docker, etc).
Stars: ✭ 8,797 (+3377.08%)
Mutual labels:  aspnetcore, aspnet
Blazortable
Blazor Table Component with Sorting, Paging and Filtering
Stars: ✭ 249 (-1.58%)
Mutual labels:  aspnetcore, aspnet
Aspnetcore Vue Starter
*NEW* Asp.net Core & Vue.js (ES6) SPA Starter kit - Vuex, webpack, Web API, Docker, and more! By @TrilonIO
Stars: ✭ 1,182 (+367.19%)
Mutual labels:  aspnetcore, aspnet
Csla
A home for your business logic in any .NET application.
Stars: ✭ 865 (+241.9%)
Mutual labels:  aspnetcore, aspnet
Aspnet Api Versioning
Provides a set of libraries which add service API versioning to ASP.NET Web API, OData with ASP.NET Web API, and ASP.NET Core.
Stars: ✭ 2,154 (+751.38%)
Mutual labels:  aspnetcore, aspnet
Awesome Microservices Netcore
💎 A collection of awesome training series, articles, videos, books, courses, sample projects, and tools for Microservices in .NET Core
Stars: ✭ 865 (+241.9%)
Mutual labels:  aspnetcore, aspnet
Aspnetboilerplate
ASP.NET Boilerplate - Web Application Framework
Stars: ✭ 10,061 (+3876.68%)
Mutual labels:  aspnetcore, aspnet
Aspnet Core 3 Jwt Authentication Api
ASP.NET Core 3.1 JWT Authentication API
Stars: ✭ 443 (+75.1%)
Mutual labels:  aspnetcore, aspnet
Aspnetcore Angular Universal
ASP.NET Core & Angular Universal advanced starter - PWA w/ server-side rendering for SEO, Bootstrap, i18n internationalization, TypeScript, unit testing, WebAPI REST setup, SignalR, Swagger docs, and more! By @TrilonIO
Stars: ✭ 1,455 (+475.1%)
Mutual labels:  aspnetcore, aspnet
Simple aspnet auth
Simple ASP.NET Authorisation boilerplate project. No EF, no database, no IdentityServer4 just a basic logging in system for both cookies and JWT and a controller with a set of examples.
Stars: ✭ 105 (-58.5%)
Mutual labels:  aspnetcore, aspnet
Nopcommerce
The most popular open-source eCommerce shopping cart solution based on ASP.NET Core
Stars: ✭ 6,827 (+2598.42%)
Mutual labels:  aspnetcore, aspnet
Aspnetcore.identity.mongodb
MongoDB Data Store Adaptor for ASP.NET Core Identity
Stars: ✭ 210 (-17%)
Mutual labels:  aspnetcore, aspnet
Dotvvm
Open source MVVM framework for Web Apps
Stars: ✭ 523 (+106.72%)
Mutual labels:  aspnetcore, aspnet
Aspnetcore Vue
Sample setup on using asp.net core 2.1 + vue cli 3 in one project. This sample is deprecated and rolled into https://github.com/soukoku/AspNetCore.SpaServices.VueCli
Stars: ✭ 31 (-87.75%)
Mutual labels:  aspnetcore, aspnet
Nswag
The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
Stars: ✭ 4,825 (+1807.11%)
Mutual labels:  aspnetcore, aspnet
Aspnetcore.docs
Documentation for ASP.NET Core
Stars: ✭ 9,940 (+3828.85%)
Mutual labels:  aspnetcore, aspnet
abp-push
Push Notification System for ASP.NET Boilerplate
Stars: ✭ 16 (-93.68%)
Mutual labels:  aspnetcore, aspnet
Aspnet Core Jwt Authentication Api
ASP.NET Core 2.2 JWT Authentication API
Stars: ✭ 272 (+7.51%)
Mutual labels:  aspnetcore, aspnet
Vue Svg Inline Loader
Webpack loader used for inline replacement of SVG images with actual content of SVG files in Vue projects.
Stars: ✭ 105 (-58.5%)
Mutual labels:  vue-cli, quasar-framework
React Core Boilerplate
Powerful ASP.NET Core 3 templates with React, true server-side rendering and Docker support
Stars: ✭ 169 (-33.2%)
Mutual labels:  aspnetcore, aspnet

VueCliMiddleware - Supporting Vue Cli and Quasar Cli

This is a stand-alone module to add Vue Cli and Quasar Cli support to AspNet Core.

See the examples here: https://github.com/EEParker/aspnetcore-vueclimiddleware/tree/master/samples

ASP.NET 3.X Endpoint Routing

First, be sure to switch Vue Cli or Quasar Cli to output distribution files to wwwroot directly (not dist).

  • Quasar CLI: regex: "Compiled successfully"
  • Vue CLI: regex: "Compiled successfully" or "running at" or "Starting development server" depending on version

the reason for Starting development server ,the npm-script running checkpoint: Although the dev server may eventually tell us the URL it's listening on, it doesn't do so until it's finished compiling, and even then only if there were no compiler warnings. So instead of waiting for that, consider it ready as soon as it starts listening for requests.see the codes

See Migrating Asp.Net 2.2 to 3.0 Endpoint Routing

    public class Startup {

        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // NOTE: PRODUCTION Ensure this is the same path that is specified in your webpack output
            services.AddSpaStaticFiles(opt => opt.RootPath = "ClientApp/dist");
            services.AddControllers();
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
	    // optional base path for IIS virtual app/directory
	    app.UsePathBase("/optionalpath");
            
	    // PRODUCTION uses webpack static files
            app.UseSpaStaticFiles();

            // Routing
            app.UseRouting();
            app.UserAuthorization();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();

                endpoints.MapToVueCliProxy(
                    "{*path}",
                    new SpaOptions { SourcePath = "ClientApp" },
                    npmScript: (System.Diagnostics.Debugger.IsAttached) ? "serve" : null,
                    regex: "Compiled successfully",
                    forceKill: true,
		    wsl: false // Set to true if you are using WSL on windows. For other operating systems it will be ignored
                    );
            });
        }
    }

ASP.NET 2.2 Usage Example

    using VueCliMiddleware;

    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        public virtual void ConfigureServices(IServiceCollection services)
        {
           services.AddMvc(); // etc
           
           // Need to register ISpaStaticFileProvider for UseSpaStaticFiles middleware to work
           services.AddSpaStaticFiles(configuration => { configuration.RootPath = "ClientApp/dist"; });
        }

        public virtual void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
           // your config opts...
		   // optional basepath
		   // app.UsePathBase("/myapp");

           // add static files from SPA (/dist)
          app.UseSpaStaticFiles();

          app.UseMvc(routes => /* configure*/ );

          app.UseSpa(spa =>
            {
                spa.Options.SourcePath = "ClientApp";
#if DEBUG
                if (env.IsDevelopment())
                {
                    spa.UseVueCli(npmScript: "serve", port: 8080); // optional port
                }
#endif
            });
        }
    }

CSPROJ Configuration

You may also need to add the following tasks to your csproj file. This are similar to what are found in the default ASPNETSPA templates.

  <PropertyGroup>
    <!-- Typescript/Javascript Client Configuration -->
    <SpaRoot>ClientApp\</SpaRoot>
    <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
  </PropertyGroup>
  <Target Name="DebugEnsureNodeEnv" BeforeTargets="Build">
    <!-- Build Target:  Ensure Node.js is installed -->
    <Exec Command="node --version" ContinueOnError="true">
      <Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
    </Exec>
    <Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
  </Target>

  <Target Name="DebugEnsureNpm" AfterTargets="DebugEnsureNodeEnv">
    <!-- Build Target:  Ensure Node.js is installed -->
    <Exec Command="npm --version" ContinueOnError="true">
      <Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
    </Exec>
  </Target>

  <Target Name="EnsureNodeModulesInstalled" BeforeTargets="Build" Inputs="package.json" Outputs="packages-lock.json">
    <!-- Build Target: Restore NPM packages using npm -->
    <Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />

    <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
  </Target>

  <Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
    <!-- Build Target: Run webpack dist build -->
    <Message Importance="high" Text="Running npm build..." />
    <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build" />

    <!-- Include the newly-built files in the publish output -->
    <ItemGroup>
      <DistFiles Include="$(SpaRoot)dist\**" />
      <ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
        <RelativePath>%(DistFiles.Identity)</RelativePath>
        <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
      </ResolvedFileToPublish>
    </ItemGroup>
  </Target>

History

Due to the discussion here, it was decided to not be included in the Microsoft owned package.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].