Can I use Node.js with Express as a static web server? I need to upload new files to static directories based on requests from developers.
Can someone tell me how to do this using Node.js, since mostly we use CloudFoundry to deploy this Node.js app.
Can I use Node.js with Express as a static web server? I need to upload new files to static directories based on requests from developers.
Can someone tell me how to do this using Node.js, since mostly we use CloudFoundry to deploy this Node.js app.
yes you can.
app.use(express.static(path.join(__dirname, 'public')));
whatever files uploaded inside the public folder are served as static files from your web server and it has nothing to do with deployment.
Why not use the npm module serve-static Serving using express.
This is a simple example of using Express:
var express = require('express')
var serveStatic = require('serve-static')
var app = express()
app.use(serveStatic('public/ftp', {'index': ['default.html', 'default.htm']}))
app.listen(3000)
For uploading files with node.js you can see my answer here