Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

A starting point for loopback.io based projects with an Angular based client. Uses Typescript on both the client/server, and webpack for bundling.

Notifications You must be signed in to change notification settings

ISBX/isbx-angular-loopback-starter

Repository files navigation

Things we use:

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 build: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. The server no longer watches in development, so the client needs to be indepedently built.

  • npm run watch - concurrently watches the server and the client - rebuilds, restarts the server as necessary. Most of the time you can just run this.

Directory structure:

/client     - Angular stuff goes in here
  /build    - webpack build artifacts (from npm run build)
  /src      - your Angular 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 ng side testing
  • add a top level common directory, primarily for sharing model interfaces between the server and the client codebase

About

A starting point for loopback.io based projects with an Angular based client. Uses Typescript on both the client/server, and webpack for bundling.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •