Giter Site home page Giter Site logo

pauldotknopf / javascriptviewengine Goto Github PK

View Code? Open in Web Editor NEW
74.0 12.0 14.0 7.31 MB

An ASP.NET MVC ViewEngine for rendering markup in a JavaScript environment. Ideal for React and Angular server-side rendering.

License: MIT License

C# 91.33% Batchfile 0.13% PowerShell 8.54%

javascriptviewengine's People

Contributors

aweber1 avatar ensemblebd avatar mikecasas avatar nilldk avatar pauldotknopf avatar tim-cools 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

Watchers

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

javascriptviewengine's Issues

Microsoft.AspNetCore.NodeServices.NodeHostingModel.Socket stucks requests

Hi.
Whenever i set
nodeEngine.NodeHostingModel = Microsoft.AspNetCore.NodeServices.NodeHostingModel.Socket;
the fisrt request to the site is ok, ie, node.exe starts, page loads ok. If I head to other page the browser just keeps loading and nothing happens.
Do i need anything else to have this mode working?

Thank you!
Telmo

Missing dll

Compiling JavaScriptViewEngine for .NETCoreApp,Version=v1.0

Compilation succeeded.
0 Warning(s)
0 Error(s)

Time elapsed 00:00:04.3719335

Expect required library hostpolicy.dll to be present in [C:\Projects\JavaScriptV
iewEngine\src\JavaScriptViewEngine\bin\Debug\netcoreapp1.0]

  • This may be because of an invalid .NET Core FX configuration in the directory.

What is wrong here?
Is this supposed to run under rc2?

How to debug view-related internal server error

I know the line of JS that's causing the internal server error, but I don't know why. How can I debug what's running inside the view?

I'm seeing:
image

The offending code is:
image

The problem is that I don't know why and I can't see any obvious way to trouble-shoot the problem.

EDIT: Specifically the code that runs perfectly on the client but breaks on the server view rendering is:

new ApiClient()['get']('api/people/load').then((data) => {
  stores.people = data;
});

That's the code in the loadPeople method.

Adding key NODE_PATH in javascriptViewEngine

Hi Paul,
I just run the "dotnet run" command and all works fine with the boilerplate but when i run the solution with visual studio 2015 i have an issue with the "already existing NODE_PATH key", i think that can be resolved with this fix aspnet/JavaScriptServices@a881ca5 in this file JavaScriptViewEngine/src/JavaScriptViewEngine/NodeServices/HostingModels/OutOfProcessNodeInstance.cs on line 69.

I hope it help you.

Pol

Question on robustness

Hi,

Just a quick question to ask whether you use this in production? Or plan to?
And did you run benchmarks for it?

Thanks

Tim

Return View with "js-{auto}" question

I was just wondering if you can explain the "js-{auto}" portion of this code

return View("js-{auto}", new GreetingViewModel { Greeting = greeting });

and the $"js-/statuscode{statusCode} in this code

return View($"js-/statuscode{statusCode}", await BuildState());

Is it possible to specify an entry point other than wwwroot/default.js?

Using Webpack and React. I have a server.js build to wwwroot/dist/server.js which is the one I would like to use.

I have tried to set it like the following in configure but still get an error.

        services.Configure<RenderPoolOptions>(options => {
            options.WatchPath = Path.Combine(environment.WebRootPath, "dist");
            options.WatchFiles = new List<string> {
                Path.Combine(options.WatchPath, "client.js"),
                Path.Combine(options.WatchPath, "server.js")
            };
        });

The error is:

Exception: Call to Node module failed with error: Error: Cannot find module '<repo>\wwwroot\default'

Is there a different way to set this value?

Compatability issue with ASP.NET Core 1.0

When building and running with the newly released ASP.NET Core 1.0, it fails on runtime:

System.TypeLoadException
Could not load type 'Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionExtensions' from assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
 System.Reflection.TargetInvocationException
Exception has been thrown by the target of an invocation.

at System.RuntimeMethodHandle.InvokeMethod(object target, Object[] arguments, Signature sig, bool constructor)


at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(object obj, Object[] parameters, Object[] arguments)


at System.Reflection.RuntimeMethodInfo.Invoke(object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)


at System.Reflection.MethodBase.Invoke(object obj, Object[] parameters)


at Microsoft.AspNetCore.Hosting.Internal.ConfigureServicesBuilder.Invoke(object instance, IServiceCollection exportServices)


at Microsoft.AspNetCore.Hosting.Internal.<>c__DisplayClass4_0.<Build>b__0(IServiceCollection services)


at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)


at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()


at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

on services.AddJsEngine(); in Startup.cs.

RuntimeBinderException coming from write async

I'm not really sure how I got this exception but I think its happening when an empty object is passed into the enhancer at the end of configure store like this:

export default function configureStore(initialState, history) {
    const state = {};

    const enhancer = compose(
      applyMiddleware(thunk),
      applyMiddleware(routerMiddleware(history)),
      devTools
    )(createStore);

    return enhancer(reducers, state);
}

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The call is ambiguous between the following methods or properties: 'System.IO.TextWriter.WriteAsync(string)' and 'System.IO.TextWriter.WriteAsync(char[])'
   at CallSite.Target(Closure , CallSite , TextWriter , Object )
   at CallSite.Target(Closure , CallSite , TextWriter , Object )
   at JavaScriptViewEngine.JsViewEngine.JsView.<RenderAsync>d__8.MoveNext()

It appears to be coming from one of these two lines:

await context.Writer.WriteAsync(result.Html);

await context.Writer.WriteAsync(result.Html);

I'll try to set up a project tonight that makes this reproducible for you since I can't share the project the error is happening in.

ASP.NET Core 2.0 Support?

Are there any plans to update this library to support ASP.NET Core 2.0? I downloaded the source and it looks like all that needs to be done is to use InvokeExportAsync instead of InvokeExport in NodeRenderEngine.cs, as it was renamed in INodeServices.

Missing `src/JavaScriptViewEngine.Mvc5` project

Hi,

I pulled the latest and attempt to build using ./build.ps1 and I encounter errors from the Build task about a missing JavaScriptViewEngine.Mvc5 project reference. Also attempt to load the solution in VS and the JavaScriptViewEngine.Mvc5 project doesn't load. Looking at the path in the .sln file it's referencing src/JavaScriptViewEngine.Mvc5/JavaScriptViewEngine.Mvc5.csproj, which doesn't appear to be in the repo. Perhaps an issue with .gitignore?

Cheers!

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.