I’m using ssh root to a VPS Ubuntu 10.04 server from Linode that has Node.JS, Express, MongoDB, etc. installed.
What I’m wondering is if I have a file called test-file.js with code:
var express = require('express');
var app = express.createServer();
// Configuration
app.configure( function() {
});
// Routes
app.get('/', function(req, res) {
res.send('Hello World');
});
app.listen(3000);
How do I upload the file or make it work with the server?
Use the
scp(secure copy) command to copy the file over to the linode box.scp path/to/test-file.js root@linodebox:/rootRemember to replace
linodeboxwith the ip address of your linode server.This will put
test-file.jsin the/rootdirectory and you can usenode test-file.jsto run the file. Grant that nodejs and express is installed correctly.