background preloader

Node

Facebook Twitter

Node.js server side javascript. Keeping your Node Server running Forever - Tony Lea. Yeah, it’s really cool that you can start your node server from a terminal window by typing ‘node server.js’, but then you close the terminal or disconnect and your node server is no longer running… Well, wouldn’t it be great if you were able to keep your Node servers running forever?

That’s exactly what you can do with the tool ‘Forever’. Forever is super easy to install: $ [sudo] npm install forever You may want to add this globally by adding ‘-g’ at the end of that command. So, after you have installed forever, you can simply get a Node JS server running forever by typing: $ forever start server.js And just like that your server.js Node will be running forever. . $ forever list 0 server.js [ 24611, 24596 ] The command will list the current index, server file, and the process ID’s. Then to stop the server you would simply enter: $ forever stop 0 Forever stopped process: 0 server.js [ 24611, 24596 ] By passing in the index of the current running server, ‘Forever’ will stop that server. How to Scrape Web Pages with Node.js and jQuery. Node.js is growing rapidly; one of the biggest reasons for this is thanks to the developers who create amazing tools that significantly improve productivity with Node.

How to Scrape Web Pages with Node.js and jQuery

In this article, we will go through the basic installation of Express, a development framework, and creating a basic project with it. What We're Going to Build Today Node is similar in design to, and influenced by, systems like Ruby's Event Machine or Python's Twisted. Node takes the event model a bit further - it presents the event loop as a language construct instead of as a library. In this tutorial, we will scrape the YouTube home page, get all the regular sized thumbnails from the page as well as links and video duration time, send all those elements to a jQueryMobile template, and play the videos using YouTube embed (which does a nice job of detecting device media support (flash/html5-video). You should also refer to our "Node.js: Step by Step" series.

Step 1: Setting Up Express So what exactly is Express? Request app.js. How to Create a Resumable Video Uploader in Node.js. If you've ever uploaded a considerably large video file, then you know this feeling: you're 90% done, and accidentally refresh the page - having to start all over again.

How to Create a Resumable Video Uploader in Node.js

In this tutorial, I'll demonstrate how to make a video uploader for your site that can resume an interrupted upload, and generate a thumbnail upon completion. Intro To make this uploader resumable, the server needs to keep track of how much a file has already been uploaded, and be able to continue from where it left off. To accomplish this task, we will give full control to the Node.js server to request specific blocks of data, and the HTML form will pickup these requests and send the necessary information to the server.

To handle this communication, we'll use Socket.io. This is the basic concept; we will start with the HTML form. Step 1: The HTML I am going to keep the HTML fairly simple; all we need is an input to choose a file, a text box for the name, and a button to begin the upload. Step 2: Making it Work Conclusion. Moment.js - A lightweight javascript date library.