Skip to Content
Node.js 6.x Blueprints
book

Node.js 6.x Blueprints

by Fernando Monteiro
August 2016
Intermediate to advanced
376 pages
6h 33m
English
Packt Publishing
Content preview from Node.js 6.x Blueprints

Dealing with LoopBack boot files

Boot files are very important in applications using a LoopBack framework. These files are started when the application is executed, and can perform various kinds of task.

The application already has all the endpoints that it needs. So, let's see how to create a boot file and use another feature from the LoopBack framework to migrate our models to the database.

In this example, we will see how to use the automigrate function to insert some content in the database at the time we start the application:

Tip

You can read more about the LoopBack API at http://apidocs.strongloop.com/.

Inside server/boot, create a new file called create-sample-models.js and place the following content in it:

 module.exports = function(app) { ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Node.js Development

Learning Node.js Development

Andrew Mead
VB.NET Core Classes in a Nutshell

VB.NET Core Classes in a Nutshell

Budi Kurniawan, Ted Neward
Your First Week With Node.js, 2nd Edition

Your First Week With Node.js, 2nd Edition

James Hibbard, Craig Buckler, Mark Brown, Nilson Jacques, James Kolce, Paul Orac, M. David Green, Florian Rappl

Publisher Resources

ISBN: 9781785888434Supplemental Content