Code Monkey home page Code Monkey logo

javascriptservices's Introduction

JavaScriptServices [Archived]

IMPORTANT

The features described in this article are obsolete as of ASP.NET Core 3.0. A simpler SPA frameworks integration mechanism is available in the Microsoft.AspNetCore.SpaServices.Extensions NuGet package. For more information, see [Announcement] Obsoleting Microsoft.AspNetCore.SpaServices and Microsoft.AspNetCore.NodeServices.

What is this?

JavaScriptServices is a set of client-side technologies for ASP.NET Core. It provides infrastructure that you'll find useful if you:

  • Use Angular / React / Vue / Aurelia / Knockout / etc.
  • Build your client-side resources using Webpack.
  • Execute JavaScript on the server at runtime.

Read Building Single Page Applications on ASP.NET Core with JavaScriptServices for more details.

This repo contains:

  • A set of NuGet/NPM packages that implement functionality for:
    • Invoking arbitrary NPM packages at runtime from .NET code (docs)
    • Server-side prerendering of SPA components (docs)
    • Webpack dev middleware (docs)
    • Hot module replacement (HMR) (docs)
    • Server-side and client-side routing integration (docs)
    • Server-side and client-side validation integration
    • "Lazy loading" for Knockout apps
  • Samples and docs

It's cross-platform (Windows, Linux, or macOS) and works with .NET Core 2.0 or later.

Creating new applications

Prerequisites:

With these prerequisites, you can immediately create new ASP.NET Core applications that use Angular, React, or React+Redux without having to install anything extra.

Option 1: Creating Angular/React/Redux applications from the command line (cross-platform)

In an empty directory, run (for example) dotnet new angular. Other supported SPA frameworks include React and React+Redux. You can see the list of available SPA templates by running dotnet new spa.

Once the generator has run and restored all the dependencies, you can start up your new ASP.NET Core SPA:

npm install
dotnet run

Option 2: Creating Angular/React/Redux applications using Visual Studio 2017 Update 3 or later (Windows only)

Using the File->New Project dialog, select ASP.NET Core Web Application. You will then be offered the option to create an application with Angular, React, or React+Redux. When the application is created, you can build and run it in the normal way.

More info and other SPA frameworks

For a more detailed (albeit somewhat outdated) walkthrough, see getting started with the aspnetcore-spa generator.

If you want to build an ASP.NET Core application with Aurelia, Knockout, or Vue, you can use the Microsoft.AspNetCore.SpaTemplates package. On the command line, run dotnet new --install Microsoft.AspNetCore.SpaTemplates. Then you will be able to run dotnet new aurelia (or dotnet new vue, etc.) to create your new application.

Adding to existing applications

If you have an existing ASP.NET Core application, or if you just want to use the underlying JavaScriptServices packages directly, you can install these packages using NuGet and NPM:

  • Microsoft.AspNetCore.NodeServices
    • This provides a fast and robust way for .NET code to run JavaScript on the server inside a Node.js environment. You can use this to consume arbitrary functionality from NPM packages at runtime in your ASP.NET Core app.
    • Most applications developers don't need to use this directly, but you can do so if you want to implement your own functionality that involves calling Node.js code from .NET at runtime.
    • Find documentation and usage examples here.
  • Microsoft.AspNetCore.SpaServices
    • This provides infrastructure that's generally useful when building Single Page Applications (SPAs) with technologies such as Angular or React (for example, server-side prerendering and webpack middleware). Internally, it uses the NodeServices package to implement its features.
    • Find documentation and usage examples here

There were previously other packages called Microsoft.AspNetCore.AngularServices and Microsoft.AspNetCore.ReactServices but these are not currently needed - all applicable functionality is in Microsoft.AspNetCore.SpaServices, because it's sufficiently general.

If you want to build a helper library for some other SPA framework, you can do so by taking a dependency on Microsoft.AspNetCore.SpaServices and wrapping its functionality in whatever way is most useful for your SPA framework.

Samples

The samples directory contains examples of:

  • Using the JavaScript services family of packages with Angular and React.
  • A standalone NodeServices usage for runtime code transpilation and image processing.

To run the samples:

  • Clone this repo
  • At the repo's root directory (the one containing src, samples, etc.), run dotnet restore
  • Change directory to the sample you want to run (for example, cd samples/angular/MusicStore)
  • Restore Node dependencies by running npm install
    • If you're trying to run the Angular "Music Store" sample, then also run gulp (which you need to have installed globally). None of the other samples require this.
  • Run the application (dotnet run)
  • Browse to http://localhost:5000

javascriptservices's People

Contributors

aaronpowell avatar aidansteele avatar aspnetci avatar davidfowl avatar eilon avatar gregbty avatar henkmollema avatar juntaoluo avatar kevenvz avatar kichalla avatar laskoviymishka avatar madskristensen avatar markpieszak avatar mattvperry avatar mikeharder avatar mseifert04 avatar natemcmaster avatar nicemd avatar novascreen avatar pakrym avatar pauldotknopf avatar pglazkov avatar pranavkm avatar rick-anderson avatar rosieks avatar ryanbrandenburg avatar scottaddie avatar stephtr avatar stevesandersonms avatar thoughtentity avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javascriptservices's Issues

Update to use Babel 6

This is an awesome project and I founded recently. I am very interested especially for React and server side rendering part of it. I am trying to improve the tooling on the field so I have published a nuget package GitHub project which simplifies the webpack integration. Especially for simple scenarios like the sample an external configuration file is not required and all the references to the scripts are added automatically. I tried to add it to the sample and make a pull request but when update the babel to latest versions (6+) I am getting an error for server side rendering. Are there any plans to update to the latest babel?

Overlap with ReactJS.NET?

Hello!

I just found out about this project today. I work on a project called ReactJS.NET that handles compiling JSX files to JavaScript (via Babel), and server-side rendering of React components, both in ASP.NET 4 and 5. It seems like there'd be quite a bit of overlap between what ReactJS.NET provides and what Microsoft.AspNet.ReactServices provides. What are the advantages that ReactServices would provide over ReactJS.NET? ๐Ÿ˜ƒ

Currently with ReactJS.NET I'm using V8 and falling back to Chakra (via JavaScriptEngineSwitcher) but I've considered adding support for Node.js too. Have you seen any issues with using Node.js from ASP.NET?

Support angular-universal cache priming

This captures the HTTP requestes issued during server-side rendering, and packages them with the page so the client-side code doesn't re-issue the same requests.

Currently the implementation in angular-universal itself is incomplete (doesn't support current Angular 2 http APIs), so we need to wait for that.

Exception thrown upon appending to NODE_PATH

An exception is thrown upon invoking EnsureReady() in Microsoft.AspNet.NodeServices/HostingModels/OutOfProcessNodeInstance.cs.

Framework: dnx451

Stack trace:

fail: Microsoft.AspNet.Server.Kestrel[13]
      An unhandled exception was thrown by the application.
      System.ArgumentException: Item has already been added. Key in dictionary: 'NODE_PATH'  Key being added: 'NODE_PATH'
        at System.Collections.Hashtable.Insert (System.Object key, System.Object nvalue, Boolean add) <0x7f524c2ce270 + 0x00589> in <filename unknown>:0 
        at System.Collections.Hashtable.Add (System.Object key, System.Object value) <0x7f524c2ccfe0 + 0x0001b> in <filename unknown>:0 
        at System.Collections.Specialized.CaseSensitiveStringDictionary.Add (System.String key, System.String value) <0x414881e0 + 0x0003a> in <filename unknown>:0 
        at Microsoft.AspNet.NodeServices.OutOfProcessNodeInstance+<EnsureReady>d__13.MoveNext () <0x414873b0 + 0x004cc> in <filename unknown>:0 
      --- End of stack trace from previous location where exception was thrown ---
        at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f524c3866d0 + 0x00029> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f524c3846b0 + 0x000a7> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f524c384630 + 0x0006b> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f524c3845e0 + 0x0003a> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x7f524c3845c0 + 0x00012> in <filename unknown>:0 
        at Redouble.AspNet.Webpack.NodeHost+<EnsureClient>d__6.MoveNext () <0x41486a30 + 0x001d1> in <filename unknown>:0 
      --- End of stack trace from previous location where exception was thrown ---
        at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f524c3866d0 + 0x00029> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f524c3846b0 + 0x000a7> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f524c384630 + 0x0006b> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f524c3845e0 + 0x0003a> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x7f524c3845c0 + 0x00012> in <filename unknown>:0 
        at Redouble.AspNet.Webpack.NodeHost+<Invoke>d__15.MoveNext () <0x41485870 + 0x00264> in <filename unknown>:0 
      --- End of stack trace from previous location where exception was thrown ---
        at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f524c3866d0 + 0x00029> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f524c3846b0 + 0x000a7> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f524c384630 + 0x0006b> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f524c3845e0 + 0x0003a> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () <0x7f524c3848d0 + 0x00017> in <filename unknown>:0 
        at Redouble.AspNet.Webpack.WebpackService+<CreateHost>d__5.MoveNext () <0x41461360 + 0x00325> in <filename unknown>:0 
      --- End of stack trace from previous location where exception was thrown ---
        at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f524c3866d0 + 0x00029> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f524c3846b0 + 0x000a7> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f524c384630 + 0x0006b> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f524c3845e0 + 0x0003a> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () <0x7f524c3848d0 + 0x00017> in <filename unknown>:0 
        at Redouble.AspNet.Webpack.WebpackService+<GetFile>d__7.MoveNext () <0x414c58f0 + 0x001b9> in <filename unknown>:0 
      --- End of stack trace from previous location where exception was thrown ---
        at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f524c3866d0 + 0x00029> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f524c3846b0 + 0x000a7> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f524c384630 + 0x0006b> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f524c3845e0 + 0x0003a> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () <0x7f524c3848d0 + 0x00017> in <filename unknown>:0 
        at Redouble.AspNet.Webpack.DevServer+<Invoke>d__4.MoveNext () <0x414c47b0 + 0x0081f> in <filename unknown>:0 
      --- End of stack trace from previous location where exception was thrown ---
        at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f524c3866d0 + 0x00029> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f524c3846b0 + 0x000a7> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f524c384630 + 0x0006b> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f524c3845e0 + 0x0003a> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x7f524c3845c0 + 0x00012> in <filename unknown>:0 
        at Microsoft.AspNet.Hosting.Internal.RequestServicesContainerMiddleware+<Invoke>d__3.MoveNext () <0x414c3cc0 + 0x00573> in <filename unknown>:0 
      --- End of stack trace from previous location where exception was thrown ---
        at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f524c3866d0 + 0x00029> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f524c3846b0 + 0x000a7> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f524c384630 + 0x0006b> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f524c3845e0 + 0x0003a> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x7f524c3845c0 + 0x00012> in <filename unknown>:0 
        at Microsoft.AspNet.Hosting.Internal.HostingEngine+<>c__DisplayClass32_0+<<Start>b__0>d.MoveNext () <0x414bed50 + 0x00436> in <filename unknown>:0 
      --- End of stack trace from previous location where exception was thrown ---
        at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f524c3866d0 + 0x00029> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f524c3846b0 + 0x000a7> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f524c384630 + 0x0006b> in <filename unknown>:0 
        at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f524c3845e0 + 0x0003a> in <filename unknown>:0 
        at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () <0x7f524c384b10 + 0x00012> in <filename unknown>:0 
        at Microsoft.AspNet.Server.Kestrel.Http.Frame+<RequestProcessingAsync>d__79.MoveNext () <0x4149dbe0 + 0x00ddc> in <filename unknown>:0 

At the time of writing, WebpackAspnetMiddleware (0.7.7) uses version 1.0.0-alpha6.

Server-side prerendering for KO apps (and/or other frameworks)

We can go beyond just Angular and React and show how server-side prerendering can be achieved for other frameworks, even those that do not have special features for server-side execution. For example, Knockout.js can be run on the server in Node via JSDom.

Angular2 server render: Cannot find module 'parse5/index'

Hi all,

I try to add server render to my NG2 app with aspnet core backend and expirience some issues:
[Node] root directory: c:\dev\Source\Repos\TaxiExchange.Back\src\TaxiExchange.Back [Node] Unhandled rejection Error: Cannot find module 'parse5/index' [Node] at Function.Module._resolveFilename (module.js:339:15) [Node] at Function.Module._load (module.js:290:25) [Node] at Module.require (module.js:367:17) [Node] at require (internal/module.js:16:19) [Node] at Object.<anonymous> (diffing_plugin_wrapper-output_path-jakXnMmL.tmp/angular2/src/platform/server/parse5_adapter.ts:1:14) [Node] at Module._compile (module.js:413:34) [Node] at Object.Module._extensions..js (module.js:422:10) [Node] at Module.load (module.js:357:32) [Node] at Function.Module._load (module.js:314:12) [Node] at Module.require (module.js:367:17) [Node] at require (internal/module.js:16:19) [Node] at Object.<anonymous> (c:\dev\Source\Repos\TaxiExchange.Back\src\TaxiExchange.Back\node_modules\angular2-universal\src\node\node.ts:2:1) [Node] at Module._compile (module.js:413:34) [Node] at Object.Module._extensions..js (module.js:422:10) [Node] at Module.load (module.js:357:32) [Node] at Function.Module._load (module.js:314:12) [Node] at Module.require (module.js:367:17) [Node] at require (internal/module.js:16:19) [Node] at Object.<anonymous> (c:\dev\Source\Repos\TaxiExchange.Back\src\TaxiExchange.Back\node_modules\angular2-universal\src\node\index.ts:1:22) [Node] at Module._compile (module.js:413:34) [Node] at Object.Module._extensions..js (module.js:422:10) [Node] at Module.load (module.js:357:32)
My server-boot.ts pretty much same as template.
Could any please advise with this.

React .tsx typescript files not working

I setup a small app to test NodeServices with React.js, webpack and Typescript but it does not render the Hello component to screen. No client-side errors, the webpack bundle is getting included, but NodeServices isn't sending down the pre-rendered html to the page with Typescript added to the equation.

Is there something special I need to do to get it to render with Typescript in the mix?

hello.tsx

import React = require("react");

export default class Hello extends React.Component<any, any> {

    render() {
        return <div>Hello world!</div>;
    }
}

index.cshtml

<div id="react-app" asp-prerender-module="ReactApp/UI/Views/hello.tsx"
     asp-prerender-webpack-config="webpack.config.js"></div>

@section scripts {
    <script src="/scripts/app.bundle.js"></script>
}

<h2>Home page!</h2>

Demonstrate patterns for realistic React apps on ASP.NET

Examples:

  • Server-side HTTP requests (i.e., issuing ajax requests during server-side prerendering). Possibly embedding the responses in the resulting HTML and enabling cache priming (would require client-side library code too).
  • Integrating with server-side validation

It is not necessarily true that React developers need or want any suggestions about how to do such things. Looking for community feedback on what (if anything) else ASP.NET should do to improve productivity for React developers.

Don't force Node to be on the PATH

From what I can read, the code currently assumes that Node is on the PATH. I think it's a good idea not to bundle a specific version of Node with this package, but it would be great if it was possible to specify where the Node executable is. Would make it easier to deploy multiple sites using this to the same server where the different sites use different Node versions.

Recover if the randomly-assigned port is already in use

The out-of-process Node host opens a server on port zero, which means "let Node or the OS decide". AFAIK this is implemented inside Node as "pick a random port without checking whether it's in use or not". Ideally, if the randomly-chosen port is in use, we should keep retrying until we get an available port.

Common form validation for client and server

I think one of the most boring things to worry about is form validation. I ran across an asp.net/angular package a while ago and when I saw Steve's great presentation at NDC London, I thought that this functionality might be interesting to incorporate into the AngularServices package. The current package is for Angular 1.x but it might be possible to add simular functionality to Angular 2, which I haven't start looking at yet.

It solves the quite boring and error prune work of having two places to store and handle validation strings and logic. It would be ideal to have all the validation strings and logic (i.e. the logic behind the DataAnnotations attributes) on the server which is then bundled and sent to the client and used there for validation as well.

Unfortunately, I'm not the most experienced developer and just use deveopment to keep my brain from shrinking so I don't have the skills to create a pull request for the functionality (you would probably be att asp.net core 3.0 before I have something to deliver).

The package I'm refering to is on Github at [https://github.com/AngularAgility/AngularAgility]. I think the same functionality would fit in nicely with the pre-render stuff in AngularServices. I don't know what strategy to use for custom validation...I guess the client API would need some extension API or something.

Consider a different way for hot module replacement

During going over the last commits I saw that there is an attempt to enable the hot module replacement something which is very nice. I am very interested on the subject as it adds tremendous flexibility during development.

For the same purposes I have created a small nugget package dedicated for that reason. It's called aspnet-webpack and it's enabled pretty much the same way as the approach on that repo. But I tried to simplify it by just using the webpack-dev-server module and not just the middleware. On top of that the package call the dev server with cli arguments so the presence of an external config file is not always required. And when there is a need for a file the library creates and maintains it. At the end based on the configuration the middleware intercepts the request and adds the appropriate script tag on the html page so the developer doesn't have to do that as well.

I would be interested to hear your thoughts about this.

Custom JsonSerializerSettings

Currently all the OutOfProcessNodeInstance classes use a JsonSerializerSettings object that is created inline. Can it be switched to pull from the JsonOutputFormatter that is created during the startup of the application? It is available via the asp.net DI.

npm install fails with vendor-manifest.json error

When running npm install I get the following error (on both Windows and Mac) whether installing from yeoman or directly from git repo template:

Error: Cannot find module './wwwroot/dist/vendor-manifest.json'
at Function.Module._resolveFilename (module.js:438:15)
at Function.Module._load (module.js:386:25)
at Module.require (module.js:466:17)
at require (internal/module.js:20:19)
at Object. (C:\Users\Sirockin\Source\aspnet5\spa\test\webpack.config.js:33:23)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)

Duplicate identifiers compiler errors

I get TS 2300 Duplicate identifier compiler errors. with angular2-2.0.0-alpha.53. Is there a fix for these compiler errors? The application runs fine in a browser window if I ignore the compiler errors.

Is it working with angular 2.0.0-beta.1?

I've tried updating the MusicStore sample to use angular 2.0.0-beta.1, but couldn't get it to work.

Has anybody had success using it with angular 2.0.0-beta.1?

OutOfProcessNodeInstance IDispose should WaitForExit

When killing the out of process node instance, we should wait for the process to exit (see here).

Otherwise, if you create your own INodeService (Configuration.CreateNodeServices(NodeHostingModel.Http, _scriptsDirectory.TempDirectory)), and then call Dispose() on the service, there is no telling when I can appropriately delete my temporary directory.

Here is my Dispose method in my class that users INodeServices

public void Dispose()
{
    if (_nodeServices != null)
    {
        _nodeServices.Dispose();
        _nodeServices = null;
        // the node services doesn't "WaitForExit". it should though.
        // this should be enough time for the process to fully exit.
        Thread.Sleep(TimeSpan.FromSeconds(2));
    }

    if(_scriptsDirectory != null)
    {
        _scriptsDirectory.Dispose();
        _scriptsDirectory = null;
    }
}

Method rename suggestion

Pls help Error

image

this error i get after "npm install". What I should do ?

Many thanks

Use of cluster module in Node?

Hi!
I'm curious about the strategy to keep performance high. Will you be using the cluster module in Node, or will you be creating multiple Node processes in C#?

Testing the samples leads to some errors (...uninstalled packages aspnet-prerendering ...)

Hello,

I followed the description Trying the samples more specifically : Using dnx on Windows/Mac/Linux. (on windows 7)

I did all steps: (for the react sample)

dnvm use 1.0.0-rc1-final -r coreclr
cd NodeServices
dnu restore
cd /samples/react/ReactGrid
npm install
webpack

but encountered some errors on npm packages not installed. I added the two packages below to make it work

npm install --save-dev aspnet-prerendering
npm install --save-dev aspnet-webpack

It would be best to adapt the packages.config so that others do not encounter the same problem, Or did I do something wrong.

my node version is 5.0.0
I use 1.0.0-rc1-update2 clr x86

kind regards

User authentication

Is there any solution for handling user authentication in both server side and client side?

Question: will this support spa pre-rendering & pre-fetch with more complex applications?

HI,

It's not clear from the documentation at the moment, so...

Imagin that I'm building an ng2 application that authenticates & uses an api that is on a different sub-domain (api.my-app.com) from the web client (www.my-app.com - the web client is only responsible for html, js & css - you know the static stuff).

In this example we shall use and store oauth access tokens (including possibly refresh tokens) on the client during the browser session to communicate with the api ..

I know it's still very early days for this package, so... will or how does the angular services help me with this scenario?

Cheers

Angular2 rc1 upgrade

Angular team have published first release candidate. We should upgrade template for it (and may be music store sample, but this part could be real pain).

Receiving an error Cannot find module 'angular2/src/core/compiler/compiler'

Hosting environment: Production
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
[Node] module.js:338
[Node]     throw err;
[Node]     ^
[Node]
[Node] Error: Cannot find module 'angular2/src/core/compiler/compiler'
[Node]     at Function.Module._resolveFilename (module.js:336:15)
[Node]     at Function.Module._load (module.js:286:25)
[Node]     at Module.require (module.js:365:17)
[Node]     at require (module.js:384:17)
[Node]     at Object.<anonymous> (C:\Users\daniel.comas\Desktop\Angular2Aspnet5\
Angular2Aspnet5\src\Angular2Aspnet5\node_modules\angular2-universal-patched\dist
\server\src\core\application.js:1:80)
[Node]     at Module._compile (module.js:434:26)
[Node]     at Object.Module._extensions..js (module.js:452:10)
[Node]     at Module.load (module.js:355:32)
[Node]     at Function.Module._load (module.js:310:12)
[Node]     at Module.require (module.js:365:17)

I paste my repository url if you know why:

https://github.com/danicomas/Angular2Aspnet5

Webpack default entry issue: webpackConfig.entry.main.unshift is not a function.

There is a statement inside of webpack dev middleware ts:
webpackConfig.entry['main'].unshift('webpack-hot-middleware/client');

Beside assuming that we have default main entry (which is not really good, but there is already TODO here), this allso assume that entry point is an array. Webpack is allow to you have this entry as a string.
Webpack ng2 starter as example have following config:
entry: { 'polyfills': './src/polyfills.ts', 'vendor': './src/vendor.ts', 'main': './src/main.browser.ts' },
In this scenario you will have error:
webpackConfig.entry.main.unshift is not a function.

Can not activate specified DNX runtime for Mac

When I try to activate the runtime specified in the blogpost having installed asp.net from the specified ling I get the following results:

`Davids-MacBook-Pro-6:~ sirockin$ dnvm use 1.0.0-rc1-final -r coreclr
Cannot find dnx-coreclr-darwin-x64.1.0.0-rc1-final, do you need to run 'dnvm install 1.0.0-rc1-final'?
Davids-MacBook-Pro-6:~ sirockin$ dnvm list

Active Version Runtime Architecture OperatingSystem Alias


   1.0.0-rc1-final      mono                 linux/osx       
   1.0.0-rc1-update1    mono                 linux/osx       
  • 1.0.0-rc1-update1 coreclr x64 darwin default
    1.0.0-rc1-update1 mono linux/osx

Davids-MacBook-Pro-6:~ sirockin$ dnvm install 1.0.0-rc1-final
dnx-mono.1.0.0-rc1-final already installed in /Users/sirockin/.dnx
Adding /Users/sirockin/.dnx/runtimes/dnx-mono.1.0.0-rc1-final/bin to process PATH
Davids-MacBook-Pro-6:~ sirockin$ dnvm use 1.0.0-rc1-final -r coreclr
Cannot find dnx-coreclr-darwin-x64.1.0.0-rc1-final, do you need to run 'dnvm install 1.0.0-rc1-final'?
Davids-MacBook-Pro-6:~ sirockin$`

Support angular cache priming independently of angular-universal

Ideally, you'd be able to package the results of anticipated ajax calls in the rendered page, even if you're not using server-side rendering. The cache priming feature should be independent of angular-universal.

If Angular does add this feature, we should add convenient helpers for it (maybe Razor tag helpers).

Does not work with IISExpress

Doesn't work with IISExpress, only web:

SocketException: An existing connection was forcibly closed by the remote host.

IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)

WebException: The underlying connection was closed: An unexpected error occurred on a receive.
System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

HttpRequestException: An error occurred while sending the request.
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

Unable to Load Projects

I cloned the site and open the solution.

All projects were unable to load. I got the following messages.

image

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.