Skip to content
georgeedwards edited this page Mar 4, 2016 · 23 revisions

The first step is the ensure you have your development environment setup properly. If you do not have Node or Go installed, please see the linked section.

First, you'll have to download the generator:

npm i -g generator-ng-fullstack

Then, you'll have to go to the folder that'll be the root of your application and run:

yo ng-fullstack

You'll see a few questions, some are for configuration (package.json, readme, badges for travis and coveralls, etc) and others are for the stack you'll work with. To answer the questions, use the up and down arrows on your keyboard and hit enter on your answer. Here are the questions:

What is the name of your app?
What is your username on Github?

What stack do you want? Full, client or server?
   fullstack
   client
   server

What do you want in server side?
   node
   go
What do you want in client side?
   ng1
   ng2
What transpiler do you want to use in server side?
   node
   babel
   typescript

NB: ng1 and ng2 refer to AngularJS 1.x and AngularJS 2.x respectively.

After answering all the questions, the generator will create all the files the stack needs (the todo application files and deps) and it will start to download the dependencies and devDependencies.

While the dependencies are being installed, you might want to run mongod, so your db is up. To do this, open a new termianl window and run:

$C:\MongoDB\Server\3.2\bin\mongod.exe

Depending on your installation and opperating system, your path may be different, but find the file called mongod.exe and run it, the database should then be set up and listening on port 27017. When the dependencies are ready, you'll be able to run the watcher for file changes and start the server, all you have to do is (in different terminals):

gulp npm start

Result:

When the generator is done, you should find this structure in your project directory:

├── client
│    └── dev
│        └── todo 
│            ├── components 
│            ├── services
│            ├── templates
│            └── styles
│
├── server
│    ├── api
│    │   ├── todo
│    │   │     ├── dao
│    │   │     ├── models
│    │   │     ├── controllers
│    │   │     └── routes
│    │   │
│    ├── auth     
│    │   ├── local
│    │   │
│    ├── commons  
│    │   └── static 
│    │    
│    │
│    ├── config   
│    ├── constants
│    └── routes
│    
└── tests
     ├── client    
     │   └── todo
     │        ├── services
     │        ├── models
     │        └── services
     │   
     ├── e2e
     │   └── _helpers
     │   
     └── server
         ├── _helpers
         └── todo
              ├── dao
              ├── models
              ├── controllers
              └── routes

Using node

You'll need to install node, the website contains installers for Windows, OSX and Linux. It has great documentation to help you with any issues you run into.

Dependencies

You'll need to install globally the following modules:

  • istanbul;
  • mocha;
  • babel;
  • gulp-cli.

You can run:

$ npm i -g istanbul mocha babel gulp-cli

To install them globally, or if you just want the tools to be available to your projects current directory, cd to that directory and run:

$ npm i istanbul mocha babel gulp-cli

Now you are ready to start with the generator set up.

Using Go

You'll need Go installed. Follow the guidance on that link.

Dependencies

Inside server folder, run:

$ go get

Starting the server

Inside the server folder, run:

$ go build
$ server

Testing

Inside server folder, run:

$ go test ./... -cover -bench .

#Using TypeScript To use Typescript, you will need to ensure you have both TSC (TypeScript Compiler) and Typings (the TypeScript CLI) installed, to install both:

$ npm install -g typescript-compiler typings
Clone this wiki locally