Sails.js Essentials - Shaikh Shahid - E-Book

Sails.js Essentials E-Book

Shahid Shaikh

0,0
26,39 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

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.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 79

Veröffentlichungsjahr: 2016

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



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 the Internet of today.

www.PacktPub.com

eBooks, discount offers, and more

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?

Fully searchable across every book published by PacktCopy and paste, print, and bookmark contentOn demand and accessible via a web browser

Preface

Sails.js Essentials will take you through the basics of Node.js and developing production-ready application in the Sails.js framework. This book covers interesting application and their development that will guide you through the practical aspects of software and development.

What this book covers

Chapter 1, Revisiting Node.js Concepts, takes you through some core concepts of Node.js and its working before we dive into the Sails.js and MVC concepts.

Chapter 2, Developing Node.js Web Server, explain how servers are built in Node.js. Throughout this book, we will deal with various web servers. Sails.js has an internal web server that is already written for production.

Chapter 3, Introduction to Sails.js and MVC Concepts, covers MVC concepts in brief and begins with the Sails.js installation and configuration.

Chapter 4, Developing REST API Using Sails.js, comes up with tools to build REST API faster and easier. REST APIs are essential building blocks of any web application.

Chapter 5, Build a Chat System Using Sails.js, covers how to develop a chat system using Sails.js. A chat system is very generic application across web applications.

Chapter 6, Building a Real-Time News Feed App Using Sails.js, teaches how to develop basic news feed app using Sails.js. Facebook and Twitter have very nice news feeds, which are updated as soon as a new status is needed.

Chapter 7, Creating a TODO Single-Page Application, covers how to develop a TODO application using Sails.js. TODO application needs no introduction as it's a famous application.

Chapter 8, Sails.js Production Checklist, covers how to choose Sails.js hosting and some tweaks and settings before hitting the deploy button.

What you need for this book

A computer with a generic operating system (Mac, Windows, or Linux) having capability to run Node.js and npm (node package manager).

Who this book is for

This book targets web developers, who want to build web apps with Sails.js.

Proficiency with JavaScript and Node.js is assumed along with familiarity of web development concepts. Familiarity with the MEAN (MongoDB, Express, AngularJS, and Node.js) stack is an added advantage.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "You can validate the same concept using the setTimeout() function."

A block of code is set as follows:

console.log("i am first"); setTimeout(function timeout() { console.log("i am second"); }, 5000); console.log("i am third");

Any command-line input or output is written as follows:

npm install sails -g

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Now, hit the Send button and see the response."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail <[email protected]>, and mention the book's title in the subject of your message.