• This repository has been archived on 08/Apr/2020
  • Stars
    star
    3,041
  • Rank 14,167 (Top 0.3 %)
  • Language
    C#
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[Archived] This repository has been archived

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

More Repositories

1

Mvc

[Archived] ASP.NET Core MVC is a model view controller framework for building dynamic web sites with clean separation of concerns, including the merged MVC, Web API, and Web Pages w/ Razor. Project moved to https://github.com/aspnet/AspNetCore
C#
5,633
star
2

KestrelHttpServer

[Archived] A cross platform web server for ASP.NET Core. Project moved to https://github.com/aspnet/AspNetCore
C#
2,637
star
3

SignalR

[Archived] Incredibly simple real-time web for ASP.NET Core. Project moved to https://github.com/aspnet/AspNetCore
C#
2,383
star
4

Identity

[Archived] ASP.NET Core Identity is the membership system for building ASP.NET Core web applications, including membership, login, and user data. Project moved to https://github.com/aspnet/AspNetCore
C#
1,965
star
5

Announcements

Subscribe to this repo to be notified about major changes in ASP.NET Core and Entity Framework Core
1,649
star
6

MusicStore

[Archived] MusicStore test application that uses ASP.NET/EF Core. Project moved to https://github.com/aspnet/AspNetCore
1,302
star
7

Security

[Archived] Middleware for security and authorization of web apps. Project moved to https://github.com/aspnet/AspNetCore
C#
1,267
star
8

AspLabs

Repo for ASP.NET experiments that are not ready for a production release
C#
1,218
star
9

Benchmarks

Benchmarks for ASP.NET Core
C#
1,158
star
10

dnx

OBSOLETE - see readme
C++
970
star
11

samples

Samples for ASP.NET Core
966
star
12

AspNetKatana

Microsoft's OWIN implementation, the Katana project
C#
953
star
13

Razor

[Archived] Parser and code generator for CSHTML files used in view pages for MVC web apps. Project moved to https://github.com/aspnet/AspNetCore
C#
882
star
14

DependencyInjection

[Archived] Contains common DI abstractions that ASP.NET Core and Entity Framework Core use. Project moved to https://github.com/aspnet/Extensions
C#
874
star
15

AspNetWebStack

ASP.NET MVC 5.x, Web API 2.x, and Web Pages 3.x (not ASP.NET Core)
C#
844
star
16

SignalR-samples

Samples for ASP.NET Core SignalR
JavaScript
728
star
17

aspnet-docker

[Archived] ASP.NET Core Docker images for 1.x. Go to https://github.com/dotnet/dotnet-docker for 2.1 and up.
720
star
18

WebHooks

[Archived] Libraries to create and consume web hooks on ASP.NET Core. Project moved to https://github.com/aspnet/AspLabs
C#
625
star
19

Entropy

A chaotic experimental playground for new features and ideas - check here for small and simple samples for individual features.
C#
564
star
20

Hosting

[Archived] Code for hosting and starting up an ASP.NET Core application. Project moved to https://github.com/aspnet/Extensions and https://github.com/aspnet/AspNetCore
C#
554
star
21

Logging

[Archived] Common logging abstractions and a few implementations. Project moved to https://github.com/aspnet/Extensions
C#
506
star
22

Caching

[Archived] Libraries for in-memory caching and distributed caching. Project moved to https://github.com/aspnet/Extensions
C#
480
star
23

LibraryManager

C#
443
star
24

DotNetTools

[Archived] Various .NET command line tools. Project moved to https://github.com/aspnet/AspNetCore
C#
438
star
25

HttpAbstractions

[Archived] HTTP abstractions such as HttpRequest, HttpResponse, and HttpContext, as well as common web utilities. Project moved to https://github.com/aspnet/AspNetCore
C#
384
star
26

WebSockets

[Archived] Implementation of the WebSocket protocol, along with client and server integration components.
C#
357
star
27

Microsoft.Data.Sqlite

[Archived] SQLite implementations of the System.Data.Common interfaces. Project has moved to https://github.com/aspnet/EntityFrameworkCore
C#
348
star
28

Configuration

[Archived] Interfaces and providers for accessing configuration files. Project moved to https://github.com/aspnet/Extensions
C#
326
star
29

AzureSignalR-samples

Code samples for Azure SignalR
JavaScript
317
star
30

live.asp.net

Code for live.asp.net, which hosts the ASP.NET Community Stand-up
C#
291
star
31

Routing

[Archived] Middleware for routing requests to application logic. Project moved to https://github.com/aspnet/AspNetCore
C#
273
star
32

Tooling

Issue tracker and info on Visual Studio tooling for ASP.NET
260
star
33

HttpClientFactory

[Archived] Contains an opinionated factory for creating HttpClient instances. Project moved to https://github.com/aspnet/Extensions
C#
255
star
34

jquery-validation-unobtrusive

Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.
JavaScript
246
star
35

AspNetIdentity

ASP.NET Identity for ASP.NET 4.x applications
C#
236
star
36

Diagnostics

[Archived] Diagnostics middleware for reporting info and handling exceptions and errors in ASP.NET Core, and diagnosing Entity Framework Core migrations errors. Project moved to https://github.com/aspnet/AspNetCore
C#
215
star
37

MetaPackages

[Archived] NuGet meta packages. Project moved to https://github.com/aspnet/AspNetCore
C#
212
star
38

Templating

[Archived] ASP.NET Core templates for .NET CLI and Visual Studio. Project moved to https://github.com/aspnet/AspNetCore
C#
205
star
39

Proxy

[Archived] Proxy library for ASP.NET Core. Project moved to https://github.com/aspnet/AspLabs
C#
199
star
40

dnvm

OBSOLETE - see readme
PowerShell
174
star
41

FileSystem

[Archived] Abstraction of file system APIs. Project moved to https://github.com/aspnet/Extensions
C#
171
star
42

BasicMiddleware

[Archived] Basic middleware components for ASP.NET Core. Project moved to https://github.com/aspnet/AspNetCore
C#
169
star
43

BugTracker

OBSOLETE - see readme
JavaScript
160
star
44

Universe

[Archived] Repo for building the entire ASP.NET and Entity Framework stack. Project moved to https://github.com/aspnet/AspNetCore
C#
159
star
45

Localization

[Archived] Localization abstractions and implementations for ASP.NET Core applications. Project moved to https://github.com/aspnet/AspNetCore
C#
157
star
46

Templates

This repo is OBSOLETE - please see the README file for information
C#
151
star
47

Options

[Archived] A framework for accessing and configuring POCO settings. Project moved to https://github.com/aspnet/Extensions
C#
151
star
48

IISIntegration

[Archived] ASP.NET Core IIS integration. Project has moved to https://github.com/aspnet/AspNetCore
C++
148
star
49

jquery-ajax-unobtrusive

[Maintenance mode: only security and critical bug fixes are being worked on] Add-on to jQuery Ajax to enable unobtrusive options in data-* attributes.
JavaScript
143
star
50

SignalR-Client-Cpp

C++ Client for ASP.NET Core SignalR
C++
134
star
51

Blazor.Docs

Docs for Blazor
CSS
134
star
52

Blazor-Hackathon

Blazor is now official and is part of the ASP.NET Core Framework. All the work is tracked in the dotnet/aspnetcore repo.
C#
131
star
53

DataProtection

[Archived] Data Protection APIs for protecting and unprotecting data. Project moved to https://github.com/aspnet/AspNetCore
C#
130
star
54

AspNetWebHooks

Libraries to create and consume web hooks on ASP.NET 4.x (Due to other priorities this project is currently in maintenance mode only. There are no planned releases at this time. No new features are planned and we are only addressing critical issues as required.)
C#
128
star
55

Session

[Archived] Session state middleware for ASP.NET Core. Project moved to https://github.com/aspnet/AspNetCore
C#
125
star
56

MicrosoftConfigurationBuilders

Microsoft.Configuration.Builders
C#
116
star
57

DataAccessPerformance

Benchmarks, prototypes and discussions for database access performance investigation
C#
116
star
58

AspNetCoreModule

ASP.NET Core Module for IIS and IIS Express
C#
115
star
59

StaticFiles

[Archived] Middleware for handling requests for file system resources including files and directories. Project moved to https://github.com/aspnet/AspNetCore
C#
114
star
60

HttpSysServer

[Archived] A web server for ASP.NET Core based on the Windows Http Server API. Project moved to https://github.com/aspnet/AspNetCore
C#
106
star
61

JsonPatch

[Archived] JSON PATCH library. Project moved to https://github.com/aspnet/AspNetCore
C#
102
star
62

CORS

[Archived] Implementations of common CORS policy and CORS middleware. Project moved to https://github.com/aspnet/AspNetCore
C#
90
star
63

AuthSamples

[Archived] Samples for ASP.NET Core authentication and authorization. Project moved to https://github.com/aspnet/AspNetCore
C#
83
star
64

Razor.VSCode

[Archived] This repo has been migrated. Please use the https://github.com/aspnet/AspNetCore repo instead.
C#
82
star
65

RoslynCodeDomProvider

Roslyn CodeDOM provider
C#
80
star
66

Antiforgery

[Archived] AntiForgery token feature for ASP.NET Core. Project moved to https://github.com/aspnet/AspNetCore
C#
78
star
67

BuildTools

Infrastructure utilities used in the ASP.NET Core build system. (Obsolete: use https://github.com/dotnet/arcade for all new projects)
C#
74
star
68

ResponseCaching

[Archived] ASP.NET Core middleware for caching responses. Project moved to https://github.com/aspnet/AspNetCore
C#
69
star
69

Testing

[Archived] Testing infrastructure, including support for xUnit.net and StyleCop. Project moved to https://github.com/aspnet/Extensions
67
star
70

SignalR-Client-JS

OBSOLETE - see readme
59
star
71

SignalR-Client-Net

OBSOLETE - see readme
57
star
72

AspNetSessionState

ASP.NET Session State (not for ASP.NET Core)
C#
53
star
73

NerdDinner

Porting NerdDinner to ASP.NET 5
JavaScript
49
star
74

SignalR-Redis

OBSOLETE - see readme
C#
48
star
75

EventNotification

[Archived] Event notification system for broadcasting application state and configuration. Project moved to https://github.com/aspnet/Extensions
C#
45
star
76

SignalR-SqlServer

OBSOLETE - see readme
C#
43
star
77

MvcPrecompilation

[Archived] Tooling that allows compilation of MVC Razor views as part of build and publish. Project moved to https://github.com/aspnet/AspNetCore
C#
42
star
78

KoreBuild

OBSOLETE REPO - see readme
Shell
37
star
79

vsweb-publish

Web publish support for ASP.NET 5 in Visual Studio 2015
PowerShell
33
star
80

homebrew-dnx

OBSOLETE - see readme
Ruby
32
star
81

Coherence

A build that verifies that all the packages form a consistent graph.
C#
30
star
82

AspNetWebFormsDependencyInjection

Dependency injection support for ASP.NET Web Forms 4.x
C#
30
star
83

UserSecrets

Command line tool and configuration provider for managing secrets
28
star
84

HtmlAbstractions

[Archived] HTML abstractions used for building HTML content. Project moved to https://github.com/aspnet/AspNetCore
C#
27
star
85

EntityFramework.Tools

.NET Command Line tools for Entity Framework Core
PowerShell
25
star
86

vsweb-docs

Showcase for Visual Studio web features
JavaScript
24
star
87

AzureIntegration

[Archived] Features that integrate ASP.NET Core with Azure. Project moved to https://github.com/aspnet/AspNetCore
C#
24
star
88

RazorTooling

Razor tooling for Visual Studio 2015
C#
23
star
89

PlatformAbstractions

OBSOLETE - used only for 1.0/1.1 patch builds
23
star
90

SignalR-Client-Java

OBSOLETE - see readme
23
star
91

libuv-build

Libuv build automation for ASP.NET Core
PowerShell
22
star
92

Wave

Cross-platform tools for running perf and stress tests
JavaScript
21
star
93

ServerTests

[Archived] Tests for Helios, WebListener and Kestrel. Project moved to https://github.com/aspnet/AspNetCore
C#
21
star
94

SignalR-ServiceBus

OBSOLETE - see readme
C#
21
star
95

AADIntegration

[Archived] UI and library components for integrating ASP.NET Core applications with Azure Active Directory. Project moved to https://github.com/aspnet/AspNetCore
C#
19
star
96

libuv-package

NuGet packages for libuv
PowerShell
19
star
97

BrowserLink

Browser Link loader for Visual Studio integration
C#
17
star
98

AspNetWebOptimization

ASP.NET Web Optimization for ASP.NET 4.x applications
C#
15
star
99

JitBench

Repo for testing JIT stuff
C#
15
star
100

aspnet-win-docker

Windows Docker image for ASP.NET Core [WIP]
PowerShell
15
star