Skip to content

Creating FireLoop Models

Jonathan Casarrubias edited this page Oct 27, 2016 · 19 revisions

FireLoop.io

When you start building a system, the fist thing you need to do right after your setup, is to start creating your API Models.

This models are similar to [LoopBack] Models, but with a different... This models will be created and executed using [TypeScript] instead of JavaScript.

##Creating FireLoop Models

$ cd myproject
$ fireloop model MyModel
? Enter the model name: MyModel
? Select the data-source to attach MyModel to: db (memory)
? Select model's base class PersistedModel
? Expose MyModel via the REST API? Yes
? Custom plural form (used to build REST URL): 
? Common model or server only? common
Let's add some MyModel properties now.

Enter an empty property name when done.
? Property name: text
   invoke   loopback:property
? Property type: string
? Required? No
? Default value[leave blank for none]: 

Let's add another MyModel property.
Enter an empty property name when done.
? Property name: 

Generating: ./common/models/my-model.ts

If you have experience with [LoopBack] you will see it is the same creational flow, is just that as described before; The model will be created in [TypeScript] Language.

Clone this wiki locally