Search Results

Search found 160 results on 7 pages for 'nodejs'.

Page 2/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • Examples of CoffeeScript in NodeJS?

    - by Austin Hyde
    As a pet project, I am trying to get familiar with NodeJS and CoffeeScript, and am finding it hard to get the ball rolling. I've found plenty of examples of single-file super-simple apps like in CoffeeScript's examples folder, however, none of those really show what a full application would look like. I've also scrounged Google to no avail. Do you have any examples of medium-sized, multi-file CoffeeScript/NodeJS apps I could learn from?

    Read the article

  • Managing lots of callback recursion in Nodejs

    - by Maciek
    In Nodejs, there are virtually no blocking I/O operations. This means that almost all nodejs IO code involves many callbacks. This applies to reading and writing to/from databases, files, processes, etc. A typical example of this is the following: var useFile = function(filename,callback){ posix.stat(filename).addCallback(function (stats) { posix.open(filename, process.O_RDONLY, 0666).addCallback(function (fd) { posix.read(fd, stats.size, 0).addCallback(function(contents){ callback(contents); }); }); }); }; ... useFile("test.data",function(data){ // use data.. }); I am anticipating writing code that will make many IO operations, so I expect to be writing many callbacks. I'm quite comfortable with using callbacks, but I'm worried about all the recursion. Am I in danger of running into too much recursion and blowing through a stack somewhere? If I make thousands of individual writes to my key-value store with thousands of callbacks, will my program eventually crash? Am I misunderstanding or underestimating the impact? If not, is there a way to get around this while still using Nodejs' callback coding style?

    Read the article

  • Problems building nodejs on MacOS Snow Leopard

    - by mrwooster
    I am having trouble building nodejs on MacOS Snow Leopard. I think it might have something to do with my PATH variable not being set correctly for the developer tools location. For some reason, the Developer tools (gcc, g++, make etc) are all stored in /Developer/usr/bin I added it to my PATH variable as follows: $ export PATH=$PATH:/Developer/usr/bin $ echo $PATH /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/Developer/usr/bin When i try to configure it complains about not finding open-ssl, ok, not a big problem. So I try with --without-ssl : $ ./configure --without-ssl Checking for program g++ or c++ : /Developer/usr/bin/g++ Checking for program cpp : /Developer/usr/bin/cpp Checking for program ar : /usr/bin/ar Checking for program ranlib : /Developer/usr/bin/ranlib Checking for g++ : ok Checking for program gcc or cc : /Developer/usr/bin/gcc Checking for gcc : ok Checking for library dl : yes Checking for library util : yes Checking for library rt : not found --- libeio --- Checking for library pthread : yes Checking for function pthread_create : not found /Users/Guy/git_src/node/node/deps/libeio/wscript:13: error: the configuration failed (see '/Users/Guy/git_src/node/node/build/config.log') Anyone know how I can get round this? I am suspicious that it might be something to do with the PATH or another ENV variable, but not sure. Thanks G

    Read the article

  • new project; entire node.js app

    - by Jared
    I have been looking into Node.js, express and Nowjs and love how easy it is to have real time interactions between clients. My background is mostly from CodeIgniter MVC using PHP and MYSql. I want to re make a current web project of mine from scratch to make everything better and more real time with this newer technology. After researching and doing test examples I want to use node.js , express and Nowjs for the real time interactions once someone connects to the socket.io to pull data back to clients. But use Code Igniter for the control of the site and user management , possible shopping cart/store , pretty much everything else. This is purely due to time constraints and that I am already familiar with doing it that way. I have been looking at MongoDB as an alternative to MySql, Basically the app is going to be multiple chat rooms all on one page. with the ability of notifications and private messaging. Lots of data transfer and images. before I started piecing it together I wanted to get people who have already done something similar. My model would use Code Igniter and MySQL to render the page and then connect them onto a node.js server and broadcast using express and nowjs would using a mongoDB be better than mySQL for tons of messages and data being stored or MYSQL? Also does it make since to not make the whole site on Node.js , kinda piece it together like that? I was asked to re post this somewhere else as it was not up to the format for SO, OP from here http://stackoverflow.com/questions/12649469/new-project-need-some-start-up-advice-node-js-app#comment17062924_12649469

    Read the article

  • How do I source a shell script for Node Version Manager?

    - by Matthew Patrick Cashatt
    Hi and thanks for looking! I am new to Linux/Ubuntu, but I have set up an Ubuntu box on which to run Node.js. I have had moderate success, but now I need to be able to easily upgrade my version of Node. Many folks recommend using Node Version Manager. I followed the directions, but when I try to do something like this: nvm ls I get a messaging stating that No command NVM found I have gone back to check the steps I followed to install NVM, but there is one part that is tricky for may and I think to be the culprit: sourcing the file for bash. From the instructions: To activate nvm, you need to source it from your bash shell . ~/nvm/nvm.sh I always add this line to my ~/.bashrc or ~/.profile file to have it automatically sources upon login. Often I also put in a line to use a specific version of node. So which file should I add this to? I am guessing profile since it's ubuntu?? Also, where in the file do I add this line? After I have added this line, do I need to reboot or anything? Any help would be deeply appreciated--especially if you can show me an example profile file with . ~/nvm/nvm.sh integrated so that I can see usage. Thanks, Matt

    Read the article

  • How can I stop a process from moving to the background?

    - by Alex
    I have a machine running Ubuntu server version 12.04.3 LTS. On it, I'm attempting to run a node.js server that needs to stay up and running at all times. I'm running into an issue, however, where periodically I see this happen: [1]+ Stopped sudo node server.js When this happens, I have to manually bring it back with fg, which works fine, at least until it stops again. As far as I can tell, it isn't functioning properly while stopped, since I get no log files in those windows of time. So my question is this: Is there a way to prevent it from being stopped like that? I'm running it in a tmux window, if that changes anything. Also, to address the question before it gets asked: I'm running it as sudo due to some ecryptfs issues I've been having. I was originally running it in my home directory, but when it was left alive for too long things would get out of sync and the file writes it has to do would just stop working. To mitigate that, I moved it out of my home directory, but its new location requires me to use sudo permissions for everything to work correctly. Hopefully that isn't related to the whole background task thing. (sudo and tmux tags included in case one or both turn out to actually be relevant to the solution.)

    Read the article

  • Unable to execute binary file. Exec format error

    - by user2689020
    I recently heard about Breach, a Node.js based browser. I was following the instructions on http://codeforgeek.com/2014/08/download-install-breach-browser-ubuntu-14-04/ to install it but got the following error : breach-v0.3.22-alpha.6-linux-x64/__AUTO_UPDATE_BUNDLE__/exo_browser/exo_browser: cannot execute binary file: Exec format error After some googling, I found that it is because I am trying to install the 64 bit package on the 32 bit Ubuntu installation. I tried to find 32 bit package of the same but ended up with no luck. The browser is only available in 64 bit packet(as far as i know). So, My question is : Is it possible to somehow install it on the 32 bit OS or if any program available which can run 64 bit applications on the 32 bit OS. I have been googling around and found no help. Can anyone help me? I am using Ubuntu 14.04 (32 Bit). Thank You

    Read the article

  • nodejs server hanging from time to time

    - by Johann Philipp Strathausen
    I have a node server (0.6.6) running an Express application, along with Mongoose and s3, on an Ubuntu 11.04 machine. Several times per hour, the server is hanging. That means that the application is working fine, I see the express loggings, and then all of a sudden the server stops responding. No errors, no traces, no loggings, and strangely enough the browser won't show the request even in the network debugging window. From any machine in the local network it's the same behaviour. I restart the server and it's okay again for several minutes, then again starts to hang, everytime while doing something different. The same application on Amazon on the same Ubuntu version works fine and never hangs. I know all this is kind of vague, but I don't know where to start. Has any of you seen something like this before? Any idea?

    Read the article

  • Nodejs: Change working directory when running node bin script

    - by user2433617
    I am trying to change the working directory when my nodejs script is run from a bin script. So simplified I have something like: #!/usr/bin/env node process.cd('/Users') When I then run this command like ./bin/nodefile it exits but stays in the same directory it started in. I have also tried shelljs, What is the best way to do this? I understand it's working but it's just in a separate process. Thanks.

    Read the article

  • Windows Azure PowerShell for Node.js

    - by shiju
    The Windows Azure PowerShell for Node.js is a command-line tool that  allows the Node developers to build and deploy Node.js apps in Windows Azure using Windows PowerShell cmdlets. Using Windows Azure PowerShell for Node.js, you can develop, test, deploy and manage Node based hosted service in Windows Azure. For getting the PowerShell for Node.js, click All Programs, Windows Azure SDK Node.js and run  Windows Azure PowerShell for Node.js, as Administrator. The followings are the few PowerShell cmdlets that lets you to work with Node.js apps in Windows Azure Create New Hosted Service New-AzureService <HostedServiceName> The below cmdlet will created a Windows Aazure hosted service named NodeOnAzure in the folder C:\nodejs and this will also create ServiceConfiguration.Cloud.cscfg, ServiceConfiguration.Local.cscfg and ServiceDefinition.csdef and deploymentSettings.json files for the hosted service. PS C:\nodejs> New-AzureService NodeOnAzure The below picture shows the files after creating the hosted service Create Web Role Add-AzureNodeWebRole <RoleName> The following cmdlet will create a hosted service named MyNodeApp along with web.config file. PS C:\nodejs\NodeOnAzure> Add-AzureNodeWebRole MyNodeApp The below picture shows the files after creating the web role app. Install Node Module npm install <NodeModule> The following command will install Node Module Express onto your web role app. PS C:\nodejs\NodeOnAzure\MyNodeApp> npm install Express Run Windows Azure Apps Locally in the Emulator Start-AzureEmulator -launch The following cmdlet will create a local package and run Windows Azure app locally in the emulator PS C:\nodejs\NodeOnAzure\MyNodeApp> Start-AzureEmulator -launch Stop Windows Azure Emulator Stop-AzureEmulator The following cmdlet will stop your Windows Azure in the emulator. PS C:\nodejs\NodeOnAzure\MyNodeApp> Stop-AzureEmulator Download Windows Azure Publishing Settings Get-AzurePublishSettings The following cmdlet will redirect to Windows Azure portal where we can download Windows Azure publish settings PS C:\nodejs\NodeOnAzure\MyNodeApp> Get-AzurePublishSettings Import Windows Azure Publishing Settings Import-AzurePublishSettings <Location of .publishSettings file> The following cmdlet will import the publish settings file from the location c:\nodejs PS C:\nodejs\NodeOnAzure\MyNodeApp>  Import-AzurePublishSettings c:\nodejs\shijuvar.publishSettings Publish Apps to Windows Azure Publish-AzureService –name <Name> –location <Location of Data centre> The following cmdlet will publish the app to Windows Azure with name “NodeOnAzure” in the location Southeast Asia. Please keep in mind that the service name should be unique. PS C:\nodejs\NodeOnAzure\MyNodeApp> Publish-AzureService –name NodeonAzure –location "Southeast Asia” –launch Stop Windows Azure Service Stop-AzureService The following cmdlet will stop your service which you have deployed previously. PS C:\nodejs\NodeOnAzure\MyNodeApp> Stop-AzureService Remove Windows Azure Service Remove-AzureService The following cmdlet will remove your service from Windows Azure. PS C:\nodejs\NodeOnAzure\MyNodeApp> Remove-AzureService Quick Summary for PowerShell cmdlets Create  a new Hosted Service New-AzureService <HostedServiceName> Create a Web Role Add-AzureNodeWebRole <RoleName> Install Node Module npm install <NodeModule> Running Windows Azure Apps Locally in Emulator Start-AzureEmulator -launch Stop Windows Azure Emulator Stop-AzureEmulator Download Windows Azure Publishing Settings Get-AzurePublishSettings Import Windows Azure Publishing Settings Import-AzurePublishSettings <Location of .publishSettings file> Publish Apps to Windows Azure Publish-AzureService –name <Name> –location <Location of Data centre> Stop Windows Azure Service Stop-AzureService Remove Windows Azure Service Remove-AzureService

    Read the article

  • nodejs daemon wrong architecture

    - by Greg Pagendam-Turner
    I'm trying to run 'dali' a highcharts exporter from nodejs on my Mac under OSX Mountain Lion I'm getting the following error: module.js:485 process.dlopen(filename, module.exports); ^ Error: dlopen(/Users/greg/node_modules/daemon/lib/daemon.v0.8.8.node, 1): no suitable image found. Did find: /Users/greg/node_modules/daemon/lib/daemon.v0.8.8.node: mach-o, but wrong architecture at Object.Module._extensions..node (module.js:485:11) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:362:17) at require (module.js:378:17) at Object.<anonymous> (/Users/greg/node_modules/daemon/lib/daemon.js:12:11) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) The key part is: "wrong architecture" If I run: lipo -info /Users/greg/node_modules/daemon/lib/daemon.v0.8.8.node It returns: Non-fat file: /Users/greg/node_modules/daemon/lib/daemon.v0.8.8.node is architecture: i386 I'm guessing a x64 version is requried. How do I get and install the 64 bit version of this lib?

    Read the article

  • Can I access the function body of an event listener using nodeJS jsdom

    - by Zhami
    I am using jsdom with nodeJS. I load in a large HTML document, and am using jQuery to navigate the DOM. I have a case where I have an element, and I need to access the function body of an event listener (onclick). The event listener was added in the source HTML: <a href="#" onclick="javascript:window.open('http://<rest-of-url>'); return false;"></a> The onclick attribute of the DOM element is undefined. btw: what I really want to do is get the URL (please note that <rest-of-url> is not what is in the source, a real URL spec is there) that is specified in the source.

    Read the article

  • need a code snippet to find all *.html under a folder in nodejs

    - by Nicolas S.Xu
    I'd like to find all *.html files in src folder and all its sub folders using nodejs. What is the best way to do it? var folder = '/project1/src'; var extension = 'html'; var cb = function(err, results) { // results is an array of the files with path relative to the folder console.log(results); } // This function is what I am looking for. It has to recursively traverse all sub folders. findFiles(folder, extension, cb); I think a lot developers should have great and tested solution and it is better to use it than writing one myself.

    Read the article

  • Is it worth moving from Microsoft tech to Linux, NodeJS & other open source frameworks to save money for a start-up?

    - by dormisher
    I am currently getting involved in a startup, I am the only developer involved at the moment, and the other guys are leaving all the tech decisions up to me at the moment. For my day job I work at a software house that uses Microsoft tech on a day to day basis, we utilise .NET, SqlServer, Windows Server etc. However, I realise that as a startup we need to keep costs down, and after having a brief look at the cost of hosting for Windows I was shocked to see some of the prices for a dedicated server. The cheapest I found was £100 a month. Also if the business needs to scale in the future and we end up needing multiple servers, we could end up shelling out £10's of £000's a year in SQL Server / Windows Server licenses etc. I then had a quick look at the price of Linux hosting for a dedicated server and saw the price was waaaaaay lower than windows hosting. One place was offering a machine with 2 cores for less than £20 a month. This got me thinking maybe the way to go is open source on Linux. As I write a lot of Javascript at work (I'm working on a single page backbone app at the moment), I thought maybe NodeJS and a web framework like Express would be cool to use. I then thought that instead of using SQL why not use an open source NoSQL database like MongoDB, which has great support on NodeJS? My only concern is that some of the work the application is going to do is going to be dynamically building images and various other image related stuff, i.e. stuff that is quite CPU heavy - so I'm thinking of maybe writing anything CPU heavy in C++ and consuming it as a module in Node. That's the background - but basically is Linux a good match for: Hosting a NodeJS/Express site? Compiling C++ node modules? Using a NoSQL DB like MongoDB? And is it a good idea to move to these unfamiliar technologies to save money?

    Read the article

  • NodeJS and node-mongodb-native

    - by w1nk
    Just getting started with node, and trying to get the mongo driver to work. I've got my connection set up, and oddly I can insert things just fine, however calling find on a collection produces craziness. var db = new mongo.Db('things', new mongo.Server('192.168.2.6',mongo.Connection.DEFAULT_PORT, {}), {}); db.open(function(err, db) { db.collection('things', function(err, collection) { // collection.insert(row); collection.find({}, null, function(err, cursor) { cursor.each(function(err, doc) { sys.puts(sys.inspect(doc,true)); }); }); }); }); If I uncomment the insert and comment out the find, it works a treat. The inverse unfortunately doesn't hold, I receive this error: collection.find({}, null, function(err, cursor) { ^ TypeError: Cannot call method 'find' of null I'm sure I'm doing something silly, but for the life of me I can't find it...

    Read the article

  • realtime visitors with nodejs & redis & socket.io & php

    - by orhan bengisu
    I am new to these tecnologies. I want to get realtime visitor for each products for my site. I mean a notify like "X users seeing this product". Whenever an user connects to a product counter will be increased for this product and when disconnects counter will be decreased just for this product. I tried to search a lots of documents but i got confused. I am using Predis Library for PHP. What i have done may totaly be wrong. I am not sure Where to put createClient , When to subscribe & When to unsubscribe. What I have done yet: On product detail page: $key = "product_views_".$product_id; $counter = $redis->incr($key); $redis->publish("productCounter", json_encode(array("product_id"=> "1000", "counter"=> $counter ))); In app.js var app = require('express')() , server = require('http').createServer(app) , socket = require('socket.io').listen(server,{ log: false }) , url = require('url') , http= require('http') , qs = require('querystring') ,redis = require("redis"); var connected_socket = 0; server.listen(8080); var productCounter = redis.createClient(); productCounter.subscribe("productCounter"); productCounter.on("message", function(channel, message){ console.log("%s, the message : %s", channel, message); io.sockets.emit(channel,message); } productCounter.on("unsubscribe", function(){ //I think to decrease counter here, Shold I? and How? } io.sockets.on('connection', function (socket) { connected_socket++; socket_id = socket.id; console.log("["+socket_id+"] connected"); socket.on('disconnect', function (socket) { connected_socket--; console.log("Client disconnected"); productCounter.unsubscribe("productCounter"); }); }) Thanks a lot for your answers!

    Read the article

  • NodeJS vm.runInThisContext() and lack of __filename

    - by rFactor
    Whenever I run vm.runInThisContext(code, filename), the ran code reports __filename and __dirname as undefined. This also leads to the situation that any fs.readFile and such calls will not work with relative paths. For example this does not work: fs.readFile('../file', fn); because it does not know where to relate the path to. Specifying the filename as /home/full/path/to/file.js for vm.runInThisContext function does not seem to matter at all. How can I make Node to understand the path to the file?

    Read the article

  • nodejs async.waterfall method

    - by user1513388
    Update 2 Complete code listing var request = require('request'); var cache = require('memory-cache'); var async = require('async'); var server = '172.16.221.190' var user = 'admin' var password ='Passw0rd' var dn ='\\VE\\Policy\\Objects' var jsonpayload = {"Username": user, "Password": password} async.waterfall([ //Get the API Key function(callback){ request.post({uri: 'http://' + server +'/sdk/authorize/', json: jsonpayload, headers: {'content_type': 'application/json'} }, function (e, r, body) { callback(null, body.APIKey); }) }, //List the credential objects function(apikey, callback){ var jsonpayload2 = {"ObjectDN": dn, "Recursive": true} request.post({uri: 'http://' + server +'/sdk/Config/enumerate?apikey=' + apikey, json: jsonpayload2, headers: {'content_type': 'application/json'} }, function (e, r, body) { var dns = []; for (var i = 0; i < body.Objects.length; i++) { dns.push({'name': body.Objects[i].Name, 'dn': body.Objects[i].DN}) } callback(null, dns, apikey); }) }, function(dns, apikey, callback){ // console.log(dns) var cb = []; for (var i = 0; i < dns.length; i++) { //Retrieve the credential var jsonpayload3 = {"CredentialPath": dns[i].dn, "Pattern": null, "Recursive": false} console.log(dns[i].dn) request.post({uri: 'http://' + server +'/sdk/credentials/retrieve?apikey=' + apikey, json: jsonpayload3, headers: {'content_type': 'application/json'} }, function (e, r, body) { // console.log(body) cb.push({'cl': body.Classname}) callback(null, cb, apikey); console.log(cb) }); } } ], function (err, result) { // console.log(result) // result now equals 'done' }); Update: I'm building a small application that needs to make multiple HTTP calls to a an external API and amalgamates the results into a single object or array. e.g. Connect to endpoint and get auth key - pass auth key to step 2 Connect to endpoint using auth key and get JSON results - create an object containing summary results and pass to step 3. Iterate over passed object summary results and call API for each item in the object to get detailed information for each summary line Create a single JSON data structure that contains the summary and detail information. The original question below outlines what I've tried so far! Original Question: Will the async.waterfall method support multiple callbacks? i.e. Iterate over an array thats passed from a previous item in the chain, then invoke multiple http requests each of which would have their own callbacks. e.g, sync.waterfall([ function(dns, key, callback){ var cb = []; for (var i = 0; i < dns.length; i++) { //Retrieve the credential var jsonpayload3 = {"Cred": dns[i].DN, "Pattern": null, "Recursive": false} console.log(dns[i].DN) request.post({uri: 'http://' + vedserver +'/api/cred/retrieve?apikey=' + key, json: jsonpayload3, headers: {'content_type': 'application/json'} }, function (e, r, body) { console.log(body) cb.push({'cl': body.Classname}) callback(null, cb, key); }); } }

    Read the article

  • Multi Player game using Nodejs and Socket IO

    - by Kishorevarma
    I am trying out multi player racing game using Node and Socket IO ,express . So I have tried simple example to see the latency between node server and the clients. I have a draggable image in client . when I move the image ienter code heren one client ,it has to move in all clients. so basically when I am moving the image I am sending the image position to the node server in a json format , then from there I am broadcasting to all clients. there is a ~approx 300ms latency from the time. following are the results. Client 1 sending data to server at : 286136 (timestamp) Server received at : 286271 Client2 received data at : 286470 Client3 received data at : 286479 Client4 received data at : 286487 Client5 received data at : 286520 the latency between move from client1 to client5 is 384ms. its too hight for a racing game .. here is my server code. var app = require('express').createServer(); var io = require('socket.io'); var http = require('http'); var http_server = http.createServer(); var server = http.createServer(app); server.listen(3000); var socket = io.listen(server,{ log: false }); socket.sockets.on('connection', function (client) { client.on('message', function (data){ console.log("data arrived to server",new Date().getTime()); // Below both statements are giving same latency between the client 1 and client 5 client.broadcast.emit('message',data); //socket.sockets.emit('message',data); }); }); 1) Is there any way to optimize the server code to reduce the latency? 2) is this expected latency using node and websockets ? 3) is socket io can't broadcast the data asynchronously (I mean at a same time) ? Thanks Kishorevarma

    Read the article

  • NodeJS + Express: res.redirect('back'); with params

    - by Ilya Rusanen
    I have register form on every page of my website. During registration some error may occur. After cathing error, I have to return user to previous page, showing some error tips. The problem is I dont know from which page user performs registration. That's why I use res.redirect('back');. However, I cant just redirect user back, I have to show him whats wrong. Thats why I have to pass some parameter. But res.redirect('back', (reg_error:'username')}) can not be used directly 'cause res.redirect() doesn't support parameters. How can I render prevous page with some parameter? Thanks!

    Read the article

  • (closed) nodejs responding an image (via pipe and response.end()) leads into strange behaviour

    - by johannesboyne
    What the Problem was: I had 2 different writeStreams! If WriteStram#1 is closed, the second should be closed too and then it all should be piped... BUT node is asynchronious so while one has been closed, the other one hasn't. Even the stream.end() was called... well you always should wait for the close event! thx guys for your help! I am at my wit's end. I used this code to pipe an image to my clients: req.pipe(fs.createReadStream(__dirname+'/imgen/cached_images/' + link).pipe(res)) it does work but sometimes the image is not transferred completely. But no error is thrown neither on client side (browser) nor on server side (node.js). My second try was var img = fs.readFileSync(__dirname+'/imgen/cached_images/' + link); res.writeHead(200, { 'Content-Type' : 'image/png' }); res.end(img, 'binary'); but it leads to the same strange behaviour... Does anyone got a clue for me? Regards! (abstracted code...) var http = require('http'); http.createServer(function (req, res) { Imgen.generateNew( 'virtualtwins/www_leonardocampus_de/overview/28', 'www.leonardocampus.de', 'overview', '28', null, [], [], function (link) { fs.stat(__dirname+'/imgen/cached_images/' + link, function(err, file_info) { if (err) { console.log('err', err); } console.log('file info', file_info.size); res.writeHead(200, 'image/png'); fs.createReadStream(__dirname+'/imgen/cached_images/' + link).pipe(res); }); } ); }).listen(13337, '127.0.0.1'); Imgen.generateNew just creates a new file, saves it to the disk and gives back the path (link)

    Read the article

  • Can't install NPM after installing Node on EC2 Linux instance?

    - by frequent
    I'm trying my first attempt on getting a node server set up on an amazon ec2 linux instance. I think I made it quite far. First problem I ran into was when trying to make Node the connection timed out after a while, so I need three attempts until I got this: LINK(target) /home/ec2-user/node/out/Release/node: Finished touch /home/ec2-user/node/out/Release/obj.target/node_dtrace_header.stamp touch /home/ec2-user/node/out/Release/obj.target/node_dtrace_provider.stamp touch /home/ec2-user/node/out/Release/obj.target/node_dtrace_ustack.stamp touch /home/ec2-user/node/out/Release/obj.target/node_etw.stamp make[1]: Leaving directory `/home/ec2-user/node/out' ln -fs out/Release/node node Which tells me, "Node is done", although I'm not sure it is also working as it should. Following this,this and this tutorial, I'm now stuck at installing npm. I think I first cloned into the wrong folder, which always gave me error 127, but even if I'm doing this: cd ~ git clone git://github.com/isaacs/npm.git cd npm sudo -s PATH=/usr/local/bin:$PATH make install I'm still getting this: #after cloning# make[1]: Entering directory `/root/npm' node cli.js install bash: node: command not found make[1]: *** [node_modules/.bin/ronn] Error 127 make[1]: Leaving directory `/root/npm' make: *** [man/man3/start.3] Error 2 Question:: Since I'm pretty much a newby at everything I'm trying here, can someone please tell me what I'm doing wrong and how to get npm to install? Also, in case I cloned into the wrong folder, is there a way to remove the "false clone" or is this not written to disk until I call make install and I don't need to worry? Thanks for helping out!

    Read the article

  • How to build an API on top of an existing Rails app with NodeJs and what architecture to use?

    - by javiayala
    The explanation I was recently hired by a company that has an old RoR 2.3 application with more than 100k users, a strong SEO strategy with more than 170k indexed urls, native android and ios applications and other custom-made mobile and web applications that rely on a not so good API from the same RoR app. They recently merged with a company from another country as an strategy to grow the business and the profit. They have almost the same stats, a similar strategy and mobile apps. We have just decided that we need to merge the data from both companies and to start a new app from scratch since the RoR app is to old and heavily patched and the app from the other company was built with a custom PHP framework without any documentation. The only good news is that both databases are in MySQL and have a similar structure. The challenge I need to build a new version that: can handle a lot of traffic, preserves the SEO strategies of both companies, serve 2 different domains, and have a strong API that can support legacy mobile apps from both companies and be ready for a new set of native apps. I want to use RoR 3.2 for the main web apps and NodeJs with a Restful API. I know that I need to be very careful with the mobile apps and handle multiple versions of the API. I also think that I need to create a service that can handle a lot IO request since the apps is heavily used to create orders for restaurants at a certain time of the day. The questions With all this in mind: What type of architecture do you recommend me to follow? What gems or node packages do you think will work the best? How do I build a new rails app and keep using the same database structure? Should I use NodeJS to build an API or just build a new service with Ruby? I know that I'm asking to much from you guys, but please help me by answering any topic that you can or by pointing me on the right direction. All your comments and feedback will be extremely appreciated! Thanks!

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >