万本电子书0元读

万本电子书0元读

顶部广告

Web Development with MongoDB and NodeJS电子书

售       价:¥

23人正在读 | 0人评论 9.8

作       者:Jason Krol

出  版  社:Packt Publishing

出版时间:2014-09-25

字       数:195.1万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
This book is designed for developers of any skill level that want to get up and running using Node.js and MongoDB to build full featured web applications. A basic understanding of JavaScript and HTML is the only requirement for this book.
目录展开

Web Development with MongoDB and Node.js

Table of Contents

Web Development with MongoDB and Node.js

Credits

About the Author

About the Reviewers

www.PacktPub.com

Support files, eBooks, discount offers, and more

Why subscribe?

Free access for Packt account holders

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

Errata

Piracy

Questions

1. Welcome to JavaScript in the Full Stack

Node.js changed JavaScript forever

Asynchronous callbacks

Node Package Manager

Networking and file IO

Not just on the web

Real-time web with Socket.io

The NoSQL movement

Node and MongoDB in the wild

What to expect from this book

Summary

2. Getting Up and Running

Environment assumptions and requirements

Installing Node.js

Mac OS X installation instructions

Windows 7 or 8 installation instructions

Linux installation instructions

Confirming successful Node.js installation

Bookmarking the online documentation

Installing the MongoDB server

Mac OS X installation instructions

Windows 7 or 8 installation instructions

Linux installation instructions

Confirming successful MongoDB installation

Bookmarking the online documentation

Writing your first app

The code

Launch the sample app

Check the actual database

Summary

3. Node and MongoDB Basics

A JavaScript Primer

Declaring variables

Declaring functions

Declaring objects

Functions are objects

Anonymous functions and callbacks

Arrays

Conditions and comparison operators

Flow

JSON

The basics of NodeJS

Event driven

Asynchronous

Require and modules

The NodeJS core

Installing modules using npm

The basics of MongoDB

The mongo shell

Inserting data

Querying

Updating data

Deleting data

Additional resources

Summary

4. Writing an Express.js Server

What is Express.js?

Building a complete web application

Organizing the files

Server.js – where it all begins

Booting up server.js

Configuration module

Handlebars view engine

Other template engines

Using and understanding middleware

Introducing Connect

Activating the configure module

Routers and controllers

Custom middleware

Migrating to Express v4.0.0

Using new middleware

server/configure.js

server/routes.js

Summary

5. Dynamic HTML with Handlebars

Basic syntax for Handlebars

Views

Layouts

Partial views

Handlebars Helpers

Global helpers

View-specific helpers

Rendering the views

Summary

6. Controllers and View Models

Controllers

View models

Updating the home controller

Updating the image controller

Displaying an image

Uploading an image

Helpers for reusable code

The sidebar module

The stats module

The images module

The comments module

Testing the sidebar implementation

Iterating on the UI

Summary

7. Persisting Data with MongoDB

Using MongoDB with Node

Connecting to MongoDB

Inserting a document

Retrieving a document

Introducing Mongoose

Schemas

Models

Built-in validation

Static methods

Virtual properties

Connecting with Mongoose

Defining the schema and models

Models index file

Adding CRUD to the controllers

The home controller

The image controller

Index – retrieving an image model

Create – inserting an image model

Testing everything out so far

Like – updating an image model

Comment – inserting a comment model

Wrapping it up

Helpers

Introducing the async module

The comments helper

The helper sidebar

Troubleshooting

The stats helper

The popular images helper

Iterating by adding an image removal capability

Adding a route

Adding a controller handler

Updating the Handlebars image page template

Updating the jQuery

Refactoring and improvements

Summary

8. Creating a RESTful API

What is an API?

What is a RESTful API?

Introducing Postman REST Client

Installation instructions

A quick tour of Postman REST Client

Using the JSONView Chrome extension

Creating a Basic API server

Creating sample JSON data

Responding to GET requests

Receiving data – POST and PUT requests

Removing data – DELETE

Consuming external APIs from Node.js

Consuming an API endpoint using Request

Summary

9. Testing Your Code

Tools of the trade

Running tests with the Mocha framework

Asserting tests with Chai.js

Installing Chai.js as a devDependency

Spies and stubs with Sinon.js

Stubbing node modules with Proxyquire

Writing and running your first test

Writing a test helper

Testing the application

Testing the routes

Testing the server

Testing a model

Testing a controller

Spy and stub everything!

Summary

10. Deploying with Cloud-based Services

Cloud versus traditional hosting

Infrastructure as a Service (IaaS) versus Platform as a Service (PaaS)

Introduction to Git

Deploying your application

Nodejitsu

Heroku

Amazon Web Services (AWS)

Create a MongoLab account and database

Create and configure the AWS environment

Microsoft Azure

Digital Ocean

Summary

11. Single Page Applications with Popular Frontend Frameworks

What is a Single Page Application?

Why use a frontend framework?

The TodoMVC project

Backbone.js

Ember.js

AngularJS

Frontend development tools

Automated build task managers

Dependency management

Modularity

HTML template-rendering engines

CSS transpiling

Testing and test-driven development

PhantomJS headless browser

Summary

12. Popular Node.js Web Frameworks

Meteor

Sails

hapi

Koa

Flatiron

Summary

Index

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部