Need help with express.static

Need help with express.static
0.0 0

#1

Hi forum,

I am trying to use express.static to return the file index.html, but it won’t. I am running everything on cloud9.
I have the following, which is called static.js

var express = require("express");
var path = require("path");

var app = express();

app.use(express.static(path.join(__dirname, 'public')));

app.listen(process.argv[2]);

then I run the server with

$ node static.js 3000

and I send the request to the server using

$ curl localhost:3000

But I don’t get any result. I also don’t get any error. Ideas?

the file that I want to get is /home/ubuntu/workspace/public/index.html


#2

Solved: I did not save the file. Or else, the file was there, but was empty. Now I feel dumb: I spent 2h on this!