Giter Club home page Giter Club logo

isbx-angular2-loopback-starter's Introduction

Things we use:

  • node 6.x - current LTS version. You may want to install via nvm if you have many projects with different requirements
  • Angular 2
  • Typescript 2
  • rxjs
  • bluebird (for Promises)
  • db-migrate - I prefer to have the schema versioned together with the code, and I prefer the sql mode enabled.
  • jade/pug
  • stylus
  • webpack
  • EditorConfig

Style guides:

  • https://github.com/johnpapa/angular-styleguide

  • Prefer use of common modules/libraries like bluebird and lodash versus hand rolled implementations.

  • Prefer implementing methods that are more functional in nature: they should take input, and return output. As opposed to methods that modify global state or variables that are passed in. This allows the effects of a function to be more isolated and makes it easier for developers to understand and reason the cause and effects of a function. It also makes it easier to write automated tests.

  • In general, console.log() statements should be removed and not committed.

Setting up:

> npm install
> npm install -g db-migrate

Inside psql:

> CREATE DATABASE project;
> CREATE USER project_user WITH PASSWORD 'password';
> GRANT ALL PRIVILEGES ON DATABASE "project" TO project_user;
> CREATE EXTENSION citext;
> CREATE DATABASE project_test;
> CREATE USER project_test_user WITH PASSWORD 'password_test';
> GRANT ALL PRIVILEGES ON DATABASE "project_test" TO project_test_user;
> CREATE EXTENSION citext;

Then update:

  • database.json - used by db-migrate
  • server/src/datasources.*.json - used by loopback to connect to the different databases

npm run scripts:

  • npm run build - builds production version of client (slower to build) and then builds server

  • npm run build:development - builds development version of client and then server

  • npm run buid:server - only build server

  • npm run test - runs pretests (linters) and then runs the server tests (clients tests coming)

  • npm run test:server - just runs the server tests

  • npm start - runs the server, needs to be built prior. In development, server will watch for client changes and rebuild. So you do not need to build the client before starting the server.

  • npm run watch - watches the server - rebuilds, restarts the server as necessary. And since the server also watches the client while in development, most of the time you can just run this.

Directory structure:

/client     - Angular2 stuff goes in here
  /build    - Webpack build artifacts (from npm run build)
  /src      - your ng2 Typescript code
/config     - Webpack configuration
/coverage   - Istanbul coverage reports from tests
/migrations - db-migrate consumes migrations from this directory
/node_modules
/server     - loopback stuff goes in here
  /build    - Typescript compilers output for server side goes here
  /src      - your loopback Typescript code and supporting .json files

TODO:

  • Set up Karma for ng2 side testing
  • add a top level common directory, primarily for sharing model interfaces between the server and the client codebase

isbx-angular2-loopback-starter's People

Contributors

tma-isbx avatar lailav avatar theophrastus144 avatar

Watchers

Bành Cao Quyền 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.