Not: Mart 2016 itibariyle aşağıdaki ilan geçersizdir. Şu an için açık pozisyon bulunmamaktadır.
###Creating a REST API using Node.js, Express, and MongoDB
####Installing Node.js
Go to http://nodejs.org, and click the Install button. Run the installer that you just downloaded. When the installer completes, a message indicates that Node was installed at /usr/local/bin/node and npm was installed at /usr/local/bin/npm. At this point node.js is ready to use. Let’s implement the webserver application from the nodejs.org home page. We will use it as a starting point for our project: a RESTful API to access data (retrieve, create, update, delete) in a wine cellar database.
Create a folder named nodecellar anywhere on your file system. In the wincellar folder, create a file named server.js.
// SHARE COUNT | |
$.getJSON("https://graph.facebook.com/fql?q=SELECT like_count FROM link_stat WHERE url=" + encodeURIComponent('"' + Screenshot.Meta.full_url + '"') + " &callback=?", function(t) { | |
t.data[0] && $("#share-button-fb .shot-social-count").html(shorterTotal(t.data[0].like_count)) | |
}) | |
$.getJSON("http://cdn.api.twitter.com/1/urls/count.json?url=" + encodeURIComponent(Screenshot.Meta.full_url) + "&callback=?", function(t) { | |
t.count && $("#share-button-twitter .shot-social-count").html(shorterTotal(t.count)) | |
}) |
I've developed a useful feature in KeystoneJS that lets you populate a relationship from either side, while only storing the data on one side, and am looking for feedback on whether it is something that could / should be brought back into mongoose itself. (It might be possible to add as a separate package but I suspect there'd be too much rewriting of mongoose internals for that to be a good idea).
I've added this as an issue in mongoose for consideration: #1888 but am leaving this gist in place because the examples are easier to read.
I've used Posts and Categories as a basic, contrived example to demonstrate what I'm talking about here; in reality you'd rarely load all the posts for a category but there are other real world cases where it's less unreasonable you'd want to do this, and Posts + Categories is an easy way to demo it.
The built-in population feature is really useful; not just for
uploader.bind('FilesAdded', function(up, files) { | |
//console.log (up); | |
//console.log (files); | |
$.each(files, function(i, file) { | |
$('#filelist').append( | |
'<div id="' + file.id + '">' + | |
file.name + ' (' + plupload.formatSize(file.size) + ') <b></b>' + | |
'<a href="" class="remove btn error">X</a></div>' | |
); | |
$('#uploadfiles').css('display', 'initial'); |
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |