Git Product home page Git Product logo

angular2-restfulservice's Introduction

Angular 2 RESTful Service Example

This project provides a simple look at getting started using Angular 2 to call into a RESTful service. Simply clone the project or download and extract the .zip to get started.

Angular 2 Concepts Covered

  • Using TypeScript classes and modules
  • Modules are loaded with System.js
  • Using Custom Components
  • Using the Http object for Ajax calls along with RxJS observables
  • Performing GET and PUT requests to the server
  • Working with Angular 2 service classes for Ajax calls
  • Using Angular 2 databinding and built-in directives

Software Requirements To Run Locally (there's a Docker option below as well)

  • Node.js 4.0.0 or higher
  • MongoDB 3.2 or higher

Loading MongoDB Data

Load data into MongoDB by performing the following steps:

  • Install MongoDB (https://docs.mongodb.org/manual/installation) on your machine
  • Execute 'mongod' to start the MongoDB daemon if it's not already running
  • Open a command window and navigate to the angular2-restfulservice directory
  • Run node lib/dbSeeder.js to insert the sample data (exit with ctrl + c)

Running the Application Locally

  1. Open config/config.development.json and change the host from mongodb to localhost

  2. Install supervisor: npm install supervisor -g

  3. Run npm install to install app dependencies

  4. Run npm start to compile the TypeScript and start the server

  5. Browse to http://localhost:3000

Running the Application with Docker

  1. Run npm run tsc:w in a command window to compile TypeScript to JavaScript locally (leave the window running). This is only needed when in "dev" mode.

  2. Install Docker Toolbox (http://docker.com/toolbox)

  3. Start the Docker QuickStart Terminal

  4. Navigate to this application's root folder in the terminal window

  5. Run docker-compose build to build the images

  6. Run docker-compose up to run the containers

  7. Navigate to http://192.168.99.100:3000 in a browser

  8. Live long and prosper

Note: To run the "production" build follow the instructions in docker-compose.production.yml. The local files are compied into the image with this mode so no need to have the tsc:w task running unless you're going to continue local development.

angular2-restfulservice's People

Contributors

danwahlin avatar

Watchers

James Cloos avatar Cristian Cedeño avatar

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.