nikhilnxvverma1 / angular2-express-orientjs-seed

Seed project for Angular2 (using AngularCLI) + Express + OrientJS app all in Typescript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular 2 - Express in Typescript (with OrientDB if needed)

This is a seed project for anyone looking for a nice and quick Angular 2 - Express setup in typescript. Optionally, you can also use OrientDB, a nice graph database, at the backend for storage.

Note: Make sure your node version >=6.9.0 and npm version >=3

Libraries and Frameworks incorporated:

  1. Angular2
  2. Express
  3. OrientJS
  4. Bluebird Promises
  5. Winston
  6. Angular CLI
  7. Gulp

Additionally, there is also a handy .vscode/launch.json file that makes it much easier to launch and debug server code inside VS Code.

Instructions

  1. npm install
  2. *Optional: Make sure OrientDB server is installed and running
  3. npm run build:client
  4. npm run compile:server
  5. npm start
  6. npm run watch:client (in a separate window)

*Want to use the database? Go to server/server.ts and set the flag called iWantToUseADatabase. By default, it will most likely will be false.

let iWantToUseADatabase=true;

I cant connect to the database

Go to server/index.ts. You will have to define the address and port for OrientDB server along with other necessary credentials.

How do I create my schema?

Go to server/schema.backend.ts. There you will find succinct methods for defining serveral classes (a.k.a tables) and their attributes. By default, there are already two example classes defined: User and Location, but you can drop the entire schema using methods defined in that class and create a new schema from scratch.

What happens when I make changes to the schema

The schema is ensured at the start of the server in server/index.ts. Anytime you add a new class in schema, its going to automatically pick that up at server restart. You can also consider dropping entire schema and build everything from scratch. Keep in mind, that if you change the attributes of a class, you are going to have to drop that class manually from the backend to register that change. In any case, you should feel free to tweak schema.backend to your own custom needs.

About

Seed project for Angular2 (using AngularCLI) + Express + OrientJS app all in Typescript.

License:MIT License


Languages

Language:TypeScript 79.4%Language:JavaScript 18.6%Language:HTML 1.6%Language:CSS 0.4%