microframework
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -52,3 +52,3 @@ "use strict"; | ||
configLoader.load(); | ||
this.configuration = this._configurator.get('framework'); | ||
this.configuration = this._configurator.get('framework') || {}; | ||
if (this.settings && !modulesRegistry) this.modulesRegistry = new _ModulesRegistry.ModuleRegistry(this.settings, this.configuration, this._configurator); | ||
@@ -55,0 +55,0 @@ } |
{ | ||
"name": "microframework", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "Micro framework is a bundle of express.js, mongodb ODM, validator, dependancy injection framework and restful controllers for your apps using Typescript", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -13,3 +13,3 @@ # MicroFramework | ||
## Quick Start | ||
## Installation | ||
@@ -21,5 +21,17 @@ You use framework with one or more the available modules. Lets say you want to use [express.js][1], [Mongodb ODM][2], | ||
`npm install microframework microframework-express microframework-typeodm microframework-controllers.ts microframework-validator.ts microframework-event-dispatcher.ts --save` | ||
`npm install microframework microframework-express microframework-typeodm microframework-controllers.ts | ||
microframework-validator.ts microframework-event-dispatcher.ts microframework-configurator.ts | ||
configurator.ts controllers.ts typedi typeodm validator.ts --save` | ||
2. Create `app.ts`: | ||
2. Install required tsd dependencies: | ||
`tsd install es6-promise express mongodb --save` | ||
4. Link definitions of the installed npm modules: | ||
`tsd link` | ||
## Usage | ||
1. Create `app.ts`: | ||
@@ -34,3 +46,3 @@ ```typescript | ||
new MicroFrameworkBootstrapper({ baseDirectory: __dirname }) | ||
new MicroFrameworkBootstrapper({ srcDirectory: __dirname }) | ||
.registerModules([ | ||
@@ -48,3 +60,3 @@ new ExpressModule(), | ||
3. Create configuration file `configuration/config.json`: | ||
2. Create configuration file `configuration/config.json`: | ||
@@ -67,14 +79,13 @@ ```json | ||
4. Now create your first controller, lets say QuestionController: `controller/QuestionController.ts`: | ||
3. Now create your first controller, lets say QuestionController: `controller/QuestionController.ts`: | ||
```typescript | ||
import {Controller, Get} from "controllers.ts/Annotations"; | ||
import {Response} from "express"; | ||
import {Request} from "express"; | ||
@Controller() | ||
import {JsonController, Get} from "controllers.ts/Annotations"; | ||
import {Response, Request} from "express"; | ||
@JsonController() | ||
export class QuestionController { | ||
@Get('/questions') | ||
all(request: Request, response: Response): any[] { | ||
all(): any[] { | ||
return [ | ||
@@ -88,3 +99,3 @@ { title: 'Which processor to choose?', text: 'Which processor is better: Core i5 or Core i7?' }, | ||
5. Run your app and open `http://localhost:3000/questions` in browser. You should see list of your questions. | ||
4. Run your app and open `http://localhost:3000/questions` in browser. You should see list of your questions. | ||
@@ -98,2 +109,6 @@ ## Available Modules | ||
* [microframework-event-dispatcher.ts](https://github.com/PLEEROCK/microframework-event-dispatcher.ts) - integration with [event-dispatcher.ts][7] | ||
* [microframework-winston](https://github.com/PLEEROCK/microframework-winston) - integration with [winston][8] | ||
* [microframework-elasticsearch](https://github.com/PLEEROCK/microframework-elasticsearch) - integration with [elasticsearch][9] | ||
* [microframework-rabbit.ts](https://github.com/PLEEROCK/microframework-rabbit.ts) - integration with [rabbit.js][10] | ||
* [microframework-event-dispatcher.ts](https://github.com/PLEEROCK/microframework-event-dispatcher.ts) - integration with [event-dispatcher.ts][11] | ||
@@ -113,1 +128,5 @@ ## Todos | ||
[7]: https://github.com/PLEEROCK/event-dispatcher.ts | ||
[8]: https://github.com/winstonjs/winston | ||
[9]: https://github.com/elastic/elasticsearch-js | ||
[10]: https://github.com/squaremo/rabbit.js/ | ||
[11]: https://github.com/PLEEROCK/event-dispatcher.ts |
60847
125