Discover millions of ebooks, audiobooks, and so much more with a free trial

From $11.99/month after trial. Cancel anytime.

Sails.js Essentials
Sails.js Essentials
Sails.js Essentials
Ebook200 pages52 minutes

Sails.js Essentials

Rating: 0 out of 5 stars

()

Read preview

About this ebook

Get up to speed with Sails.js development with this fast-paced tutorial

About This Book
  • Gain expertise in building web apps with Sails.js
  • Develop apps such as real-time chat app and more in no time
  • Helps you understand how MVC framework works in Node.js and how to make it work for you
Who This Book Is For

This book is for web developers who want to build web apps with Sails.js.

Proficiency with JavaScript and Node.js is assumed, as well as familiarity with web development concepts. Familiarity with the MEAN (Mongo, Express, Angular, and Node) stack would be an added advantage.

What You Will Learn
  • Find out to quick-start Sails.js and develop production-ready apps
  • Understand how to apply the MVC model of software development in Node.js using Sails.js
  • Discover how to write quality code using Sails.js
  • Integrate third-party APIs and databases such Mongo and MySQL in Sails.js
  • Get to know the advantages and importance of the MVC framework in software development
In Detail

Sails.js makes it easy to build custom, enterprise-grade Node.js apps. It is designed to emulate the familiar MVC pattern of frameworks, but with support for the requirements of modern apps: data-driven APIs with a scalable, service-oriented architecture.

This book will provide practical examples to get you started with Sails.js and get you develop production-ready apps in no time. We will take you from a Node.js web server and single threading system to a general MVC architecture. You will then learn to develop applications that you might be already familiar with using Sails.js. Finally, we will show you how to create a chat app and a to-do application, and improve code quality using JSHINT and JSCS.

Style and approach

This practical and easy-to-follow yet comprehensive guide will help you get to grips with the Sails.js framework. Each topic is explained and placed in context, and for the more inquisitive, there are more details of the concepts used.

LanguageEnglish
Release dateFeb 23, 2016
ISBN9781783554546
Sails.js Essentials

Read more from Shahid Shaikh

Related to Sails.js Essentials

Related ebooks

Programming For You

View More

Related articles

Reviews for Sails.js Essentials

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Sails.js Essentials - Shahid Shaikh

    (missing alt)

    Table of Contents

    Sails.js Essentials

    Credits

    About the Author

    About the Reviewer

    www.PacktPub.com

    eBooks, discount offers, and more

    Why subscribe?

    Preface

    What this book covers

    What you need for this book

    Who this book is for

    Conventions

    Reader feedback

    Customer support

    Downloading the example code

    Downloading the color images of this book

    Errata

    Piracy

    Questions

    1. Revisiting Node.js Concepts

    Node.js architecture

    V8

    Event driven I/O – libuv

    Single-threaded system and its working

    Working of libuv – core of Node.js

    Multi-threading versus single-threading

    Event loop and non-blocking I/O model

    Importance of event loop

    Working of event loop

    Summary

    2. Developing Node.js Web Server

    Working of web servers

    HTTP operations and their use

    Create

    Read

    Update

    Delete

    Developing web server using HTTP module

    HTTP headers and content-type

    Developing web server using Express

    Using Express to develop web server

    Routers and middleware

    Summary

    3. Introduction to Sails.js and MVC Concepts

    Getting started with MVC concepts

    Model

    View

    Controller

    Installing Sails.js

    Understanding directory structure of Sails.js project

    The assets directory

    The views directory

    The node_modules directory

    The api directory

    The config directory

    Adding database support

    Configuring MySQL database with Sails.js

    config/connections.js

    config/models.js

    Configuring MongoDB database with Sails.js

    config/connections.js

    config/models.js

    Configuring the Grunt task runner file with JSHint

    Summary

    4. Developing REST API Using Sails.js

    Why it is called REST?

    The REST CRUD operation

    Database design for REST API

    Building REST API in Sails.js

    config/connections.js

    config/models.js

    Discussing migrate key

    Running our code

    Create new message

    Read the message

    Update the message

    Delete the message

    Defining custom controller

    api/controllers/MessageController.js

    Summary

    5. Build a Chat System Using Sails.js

    Application architecture and flow

    Creating a Sails.js app

    Sails.js API for chat

    Model definition and MySQL integration in the app

    Sails.js controller to handle the chat operation

    AngularJS app for client-side interaction

    Running the application

    Summary

    6. Building a Real-Time News Feed App Using Sails.js

    Briefing Socket.IO

    Using Socket in Sails.js

    Discussing the database design of the app

    Implementing the application

    Summary

    7. Creating a TODO Single-Page Application

    MongoDB support in Sails.js

    Defining model for API

    TODO app view design

    /assets/js/app.js

    /assets/js/services/ToDoService.js

    Summary

    8. Sails.js Production Checklist

    Sails.js migrate in detail

    Sails.js security checklist

    CSRF

    CORS

    DDOS

    XSS

    Sails.js deployment checklist

    Configure production environment setting

    Run app on port 80 if there is no proxy

    Configure database settings

    Estimate the traffic from all the endpoints

    Sails.js hosting

    Summary

    Index

    Sails.js Essentials


    Sails.js Essentials

    Copyright © 2016 Packt Publishing

    All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

    Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

    Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

    First published: February 2016

    Production reference: 1190216

    Published by Packt Publishing Ltd.

    Livery Place

    35 Livery Street

    Birmingham B3 2PB, UK.

    ISBN 978-1-78355-453-9

    www.packtpub.com

    Credits

    Author

    Shaikh Shahid

    Reviewer

    Diogo Resende

    Commissioning Editor

    Kartikey Pandey

    Acquisition Editor

    Sonali Vernekar

    Content Development Editor

    Siddhesh Salvi

    Technical Editor

    Manthan Raja

    Copy Editor

    Vibha Shukla

    Project Coordinator

    Nidhi Joshi

    Proofreader

    Safis Editing

    Indexer

    Monica Ajmera Mehta

    Graphics

    Jason Monteiro

    Kirk D'Penha

    Production Coordinator

    Conidon Miranda

    Cover Work

    Conidon Miranda

    About the Author

    Shaikh Shahid has been a product developer for over two years. He has the experience of working on Node.js for more than two years. He loves to spread the word about Node.js and its various packages via his programming blog. Shahid is also very interested in software architecture and design and loves to develop software system from the core.

    When he is not playing with Node.js or helping people, he watches movies, reads books, or travels to Goa.

    I'd like to thank my father, who was not aware of my experiments with Node.js and similar things during my college days, and supported me at every step. I'd also like to thank Ashutosh sir and Jane for giving me an opportunity to work professionally on this awesome technology.

    About the Reviewer

    Diogo Resende is a passionate developer, obsessed with perfection in everything he works on. He loves everything about the Internet of Things: the ability to connect everything together and always being connected to the world. He is also the author of Node.js High Performance, Packt Publishing.

    Diogo Resende studied computer science and graduated in engineering, which deepened his knowledge about computer networking and security, software development, and cloud computing. In the past 10 years, he has embraced different challenges to develop applications and services to connect people with embedded devices around the world, creating a bridge between the ancient and uncommon protocols and

    Enjoying the preview?
    Page 1 of 1