I am new to node.js and was following the code given in this tutorial given at the time 11:33 in order to get the code below. Can someone explain why the error is occurring and how to fix it?
Currently, when I try to access localhost:2000 it works. However, attempting to access http://localhost:2000/client/img/bob.img resulted in this error.
Cannot GET /client/img/bob.img
Current directory formatting is also specified by the video at 2:35
Tutorial: https://www.youtube.com/watch?v=PfSwUOBL1YQ
var express = require("express");
var app = express();
var serv = require("http").Server(app);
app.get('/',function(req, res){
res.sendFile(__dirname + "/client/index.html")
app.use("/client", express.static(__dirname + "/client/index.html"));
serv.listen(2000);
via Xenorosth
No comments:
Post a Comment