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
- Angular2
- Express
- OrientJS
- Bluebird Promises
- Winston
- Angular CLI
- 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.
- npm install
- *Optional: Make sure OrientDB server is installed and running
- npm run build:client
- npm run compile:server
- npm start
- 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;
Go to server/index.ts. You will have to define the address and port for OrientDB server along with other necessary credentials.
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.
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.