We all are familiar with SPA or Single Page Applications like Angular 2 in development. Aurelia is another famous Single Page Application development technique in the market similar to Angular 2 but syntactically different. Now, we are going to configure Aurelia Single Page Applications in ASP.NET Core 1.0.
Before reading this article, you must read the articles given below for ASP.NET Core knowledge.
Configuring Aurelia SPA in ASP.NET Core 1.0
The following steps need to be followed to configure Aurelia Single Page Applications in ASP.NET Core 1.0.
Install Node.js
Node.js is very powerful JavaScript-based framework built on Chrome’s V8 JavaScript Engine. Node.js’ package ecosystem and npm are the largest ecosystems of open source libraries in the world.
Download and install Node.js on your machine -
Node.js
After completing the installation, we can check the current running version of Node.js in our machine through command prompt.
Command for Version Checking - "node -v"
Install Git
Install jspm
jspm or JavaScript Package Manager is a package manager for the SystemJS universal module loader and it is built on top of the dynamic ES6 module loader.
jspm installation command - "npm install -g jspm"
After installing, we can check the current running version of jspm on our machine through command prompt, using the following command.
"jspm -v"
Setting Project Location
The following command will help to change our current "C Drive" to "F Drive" because currently our Aurelia project is saved into "F Drive".
jspm Initialization
Now, we are going to install jspm in our ASP.NET Core 1.0 application.
"jspm init"
During the jspm initialization, it will ask a few questions. We have to enter three values in the following questions.
1.Enter server baseURL (public folder path) [./]
wwwroot ( I have saved all jspm references into Webroot or wwwroot but you can choose any folder ).
2. Do you wish to use a transpiler?[yes]:
yes ( Transpiler is similar to Compiler. It converts ES2015 to ES5 ).
3. Which ES6 transpiler would you like to use, Babel, TypeScript or Traceur ? [traceur] :
Babel ( You can choose either Babel or TypeScript ).
Install Aurelia Framework in ASP.NET Core 1.0
The following command will help to install Aurelia framework in ASP.NET Core 1.0.
"jspm install aurelia-framework"
Install Aurelia bootstrapper in ASP.NET Core 1.0
The following command will help to install Aurelia bootstrapper in ASP.NET Core 1.0.
"jspm install aurelia-bootstrapper"
Project Structure
Click "show all files icon" in Solution Explorer. Then, you can see the jspm_packages reference and config.js inside the wwwroot.
config.js
The following json file contains all the details about Aurelia configuration.
- System.config({
- baseURL: "/",
- defaultJSExtensions: true,
- transpiler: "babel",
- babelOptions: {
- "optional": [
- "runtime",
- "optimisation.modules.system"
- ]
- },
- paths: {
- "github:*": "jspm_packages/github/*",
- "npm:*": "jspm_packages/npm/*"
- },
-
- map: {
- "aurelia-bootstrapper": "npm:[email protected]",
- "aurelia-framework": "npm:[email protected]",
- "aurelia-pal-browser": "npm:[email protected]",
- "babel": "npm:[email protected]",
- "babel-runtime": "npm:[email protected]",
- "core-js": "npm:[email protected]",
- "github:jspm/[email protected]": {
- "assert": "npm:[email protected]"
- },
- "github:jspm/[email protected]": {
- "buffer": "npm:[email protected]"
- },
- "github:jspm/[email protected]": {
- "path-browserify": "npm:[email protected]"
- },
- "github:jspm/[email protected]": {
- "process": "npm:[email protected]"
- },
- "github:jspm/[email protected]": {
- "util": "npm:[email protected]"
- },
- "github:jspm/[email protected]": {
- "vm-browserify": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "assert": "github:jspm/[email protected]",
- "buffer": "github:jspm/[email protected]",
- "process": "github:jspm/[email protected]",
- "util": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-logging": "npm:[email protected]",
- "aurelia-metadata": "npm:[email protected]",
- "aurelia-pal": "npm:[email protected]",
- "aurelia-task-queue": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-event-aggregator": "npm:[email protected]",
- "aurelia-framework": "npm:[email protected]",
- "aurelia-history": "npm:[email protected]",
- "aurelia-history-browser": "npm:[email protected]",
- "aurelia-loader-default": "npm:[email protected]",
- "aurelia-logging-console": "npm:[email protected]",
- "aurelia-pal": "npm:[email protected]",
- "aurelia-pal-browser": "npm:[email protected]",
- "aurelia-polyfills": "npm:[email protected]",
- "aurelia-router": "npm:[email protected]",
- "aurelia-templating": "npm:[email protected]",
- "aurelia-templating-binding": "npm:[email protected]",
- "aurelia-templating-resources": "npm:[email protected]",
- "aurelia-templating-router": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-metadata": "npm:[email protected]",
- "aurelia-pal": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-logging": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-binding": "npm:[email protected]",
- "aurelia-dependency-injection": "npm:[email protected]",
- "aurelia-loader": "npm:[email protected]",
- "aurelia-logging": "npm:[email protected]",
- "aurelia-metadata": "npm:[email protected]",
- "aurelia-pal": "npm:[email protected]",
- "aurelia-path": "npm:[email protected]",
- "aurelia-task-queue": "npm:[email protected]",
- "aurelia-templating": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-history": "npm:[email protected]",
- "aurelia-pal": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-loader": "npm:[email protected]",
- "aurelia-metadata": "npm:[email protected]",
- "aurelia-pal": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-metadata": "npm:[email protected]",
- "aurelia-path": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-logging": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-pal": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-pal": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-pal": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-path": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-dependency-injection": "npm:[email protected]",
- "aurelia-event-aggregator": "npm:[email protected]",
- "aurelia-history": "npm:[email protected]",
- "aurelia-logging": "npm:[email protected]",
- "aurelia-path": "npm:[email protected]",
- "aurelia-route-recognizer": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-pal": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-binding": "npm:[email protected]",
- "aurelia-logging": "npm:[email protected]",
- "aurelia-templating": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-binding": "npm:[email protected]",
- "aurelia-dependency-injection": "npm:[email protected]",
- "aurelia-loader": "npm:[email protected]",
- "aurelia-logging": "npm:[email protected]",
- "aurelia-metadata": "npm:[email protected]",
- "aurelia-pal": "npm:[email protected]",
- "aurelia-path": "npm:[email protected]",
- "aurelia-task-queue": "npm:[email protected]",
- "aurelia-templating": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-binding": "npm:[email protected]",
- "aurelia-dependency-injection": "npm:[email protected]",
- "aurelia-logging": "npm:[email protected]",
- "aurelia-metadata": "npm:[email protected]",
- "aurelia-pal": "npm:[email protected]",
- "aurelia-path": "npm:[email protected]",
- "aurelia-router": "npm:[email protected]",
- "aurelia-templating": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "aurelia-binding": "npm:[email protected]",
- "aurelia-dependency-injection": "npm:[email protected]",
- "aurelia-loader": "npm:[email protected]",
- "aurelia-logging": "npm:[email protected]",
- "aurelia-metadata": "npm:[email protected]",
- "aurelia-pal": "npm:[email protected]",
- "aurelia-path": "npm:[email protected]",
- "aurelia-task-queue": "npm:[email protected]"
- },
- "npm:[email protected]": {
- "process": "github:jspm/[email protected]"
- },
- "npm:[email protected]": {
- "base64-js": "npm:[email protected]",
- "child_process": "github:jspm/[email protected]",
- "fs": "github:jspm/[email protected]",
- "ieee754": "npm:[email protected]",
- "isarray": "npm:[email protected]",
- "process": "github:jspm/[email protected]"
- },
- "npm:[email protected]": {
- "fs": "github:jspm/[email protected]",
- "path": "github:jspm/[email protected]",
- "process": "github:jspm/[email protected]",
- "systemjs-json": "github:systemjs/[email protected]"
- },
- "npm:[email protected]": {
- "util": "github:jspm/[email protected]"
- },
- "npm:[email protected]": {
- "process": "github:jspm/[email protected]"
- },
- "npm:[email protected]": {
- "assert": "github:jspm/[email protected]",
- "fs": "github:jspm/[email protected]",
- "vm": "github:jspm/[email protected]"
- },
- "npm:[email protected]": {
- "inherits": "npm:[email protected]",
- "process": "github:jspm/[email protected]"
- },
- "npm:[email protected]": {
- "indexof": "npm:[email protected]"
- }
- }
- });
package.json
The following JSON file contains all the dependencies of Aurelia.
- {
- "jspm": {
- "directories": {
- "baseURL": "wwwroot"
- },
- "dependencies": {
- "aurelia-bootstrapper": "npm:aurelia-bootstrapper@^2.0.1",
- "aurelia-framework": "npm:aurelia-framework@^1.0.8",
- "aurelia-pal-browser": "npm:aurelia-pal-browser@^1.1.0"
- },
- "devDependencies": {
- "babel": "npm:babel-core@^5.8.24",
- "babel-runtime": "npm:babel-runtime@^5.8.24",
- "core-js": "npm:core-js@^1.1.4"
- }
- }
- }
Reference
Conclusion
We learned how to configure Aurelia Single Page Applications in ASP.NET Core 1.0. I hope, you liked this article. Please share your valuable suggestions and feedback.