Last active
January 2, 2016 13:49
-
-
Save jfernandez/8312460 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function saveObject(request) { | |
// Return 200 and close the connection right away. | |
// The client doesn't need to wait for the DB. | |
request.reply({}).code(200); | |
db.ModelFoo.create(request.params).success(function(record) { | |
// This event gets fired some milliseconds later. | |
// You can chain other business logic here or log success. | |
}); | |
// At this point this node app is already processing other API requests | |
// without having to wait for the database | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment