Git Product home page Git Product logo

aurelia-node's Introduction

Aurelia-Node

This is a NodeJS Express App bundled with the Skeleton App of the Aurelia platform. It sets up a standard navigation-style app using gulp to build your ES6 code with the babel compiler. Karma/Jasmine testing is also configured.

For more info please visit the official site: http://www.aurelia.io/

Running The App

  1. Fork or download this repo
  2. Navigate into the folder
  3. Install the Apps dependencies
npm install
  1. Download a fresh copy of the skeleton app by issuing following command:
node bin/install
  1. Navigate to the frontend folder
cd public/app
  1. Ensure that Gulp is installed. If you need to install it, use the following command:
npm install -g gulp
  1. Ensure that jspm is installed. If you need to install it, use the following command:
npm install -g jspm

Note: jspm queries GitHub to install semver packages, but GitHub has a rate limit on anonymous API requests. It is advised that you configure jspm with your GitHub credentials in order to avoid problems. You can do this by executing jspm endpoint config github and following the prompts.

  1. Install the client-side dependencies with jspm:
jspm install

Note: Windows users, if you experience an error of "unknown command unzip" you can solve this problem by doing npm install -g unzip and then re-running jspm install.

  1. To run the app go back to the project root and execute the following command:
gulp watch
  1. Browse to http://localhost:7000 to see the app. You can make changes in the code found under src and the browser should auto-refresh itself as you save files.

Note: If you prefer to run the node app without Gulp just do node app.js

Serving views from Node

You can easily serve your Views from the Node Backend. This example uses the Swig Templating Engine, but you are of course free to choose whatever you want :) If you take a look at the folder views/welcome.html you'll see the welcome View being served by NodeJS. The route association can be found in routes/api.js. The code below demonstrates how to reply with the html file.

/* GET welcome view */
router.get('/views/welcome', function(req, res) {
  res.render('welcome', {nodePort: require('../app').get('port')});
});

In order to use this in Aurelia open the file public/app/src/welcome.js and add following method to the Welcome Class. This will make sure that the VM requests the server-side View during the navigation instruciton.

getViewStrategy() {
  return '../../views/welcome';
}

E2E Testing

An example of how to use Protractor for E2E Testing with Aurelia has been added. In order to run them you need to make sure protractor and the necessary webdriver is installed

npm install -g protractor
webdriver-manager update

Now start up the application in one Terminal with from the project root with the command:

node app.js

After that, in another Terminal, from the project root, just type following:

protractor protractor.conf.js

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.