![]() ![]() The LoopBack AngularJS SDK is packaged with v2.8.10 of the strongloop module. You can even use the API Explorer to add sample data. LoopBack's API Explorer, on the other hand, provides some basic API endpoint documentation that even lets you simulate HTTP requests. Generating documentation is a key feature that too many scaffolding frameworks ignore altogether. Here, you see that LoopBack generates basic documentation as well as routes. You should see a nice web UI with all your models and their corresponding REST API endpoints. node_modules/strongloop/bin/slc run to start up a web server, and navigate to localhost:3000/explorer. You may not have noticed it, but you've just created a very simple REST API. ? Custom plural form (used to build REST URL): BreakfastSpots ![]() ? Select model's base class: PersistedModel ? Select the data-source to attach Breakfast to: db (memory) node_modules/strongloop/bin/slc loopback:model To keep it simple, add 2 properties: a name and an address. StrongLoop will then ask you to add properties to your model. node_modules/strongloop/bin/slc loopback:model. For this example, you'll create a Breakfast model that will store good places to get some eggs and bacon in New York (which is surprisingly difficult to do given the number of places that think pastries are a breakfast food). For the sake of minimizing this example's dependencies, you'll store your model in memory. You can now use the LoopBack framework to create a database model. If this fails, try running the command yourself. Running npm install for you to install the required dependencies. ? What's the name of your application? loopback-example node_modules/strongloop/bin/slc loopback You should see the following output with StrongLoop v2.10.1: specter:loopback-example vkarpov$. node_modules/strongloop/bin/slc loopback. To create scaffolding for your new loopback-example app, run. Since you didn't install with -g, the executable lives at. You can now access StrongLoop's command-line tools through the slc command line utility. Mkdir loopback-example & cd loopback-example & npm install strongloop You'll want to go grab a cup of coffee, installing the strongloop module can take a few minutes. You can install this module with -g, but it's not necessary. StrongLoop recommends installing their npm module with the -g flag, but I avoid using -g where possible. LoopBack comes with the strongloop npm module. Setting Up LoopBackīefore you dive into these features, you'll install LoopBack and create a new project. But, LoopBack has several sweet features that help offset these difficulties. Furthermore, clearing away the scaffolding requires learning the framework's internals. This means your new project already starts off bloated. Scaffolding frameworks generate code that your application may not need. ![]() I'm usually not particularly keen on application scaffolding. In short, LoopBack is a powerful tool for generating REST APIs that you can extend to scaffold client-side code. Furthermore, LoopBack has SDKs for generating REST API clients in AngularJS, Android, and iOS. ![]() Even if you started writing your code with gift cards stored in MongoDB, LoopBack's database abstraction layer makes switching a one-liner. Say you decide to store your users in MongoDB but your user's gift cards in MySQL (for transactions). For each model you define, you can choose to store it in MongoDB, Oracle, MySQL, or Microsoft SQL Server (or even in memory). LoopBack lets you swap out different storage layers. LoopBack generates Express REST APIs by asking you a few simple questions at the command line. Recently, I've been looking into StrongLoop's LoopBack framework. ![]()
0 Comments
Leave a Reply. |