Pratik Gaikwad Pratik Gaikwad - 4 months ago 31
Node.js Question

The server has not found anything matching the requested URI node

I have below folder structure in VS2015:

Folder structure for Node web app

The server.js has below code:

var express = require('express')
var app = express();
var http = require('http').Server(app);
var path = require('path');

var port = process.env.port || 1337;
app.use(express.static(__dirname + 'client'));
app.get('/', function (req, res) {
res.sendFile(path.join(__dirname,'client', 'HTML1.html'));

http.listen(port, function () {
console.log(`listning on ${port}`);

and Html1.Html has below code:

<!DOCTYPE html>

<html xmlns="">
<head data-ng-app="imageLoaderApp">
<meta charset="utf-8" />

<script src="/client/scripts/angular.js"></script>
<script type="text/javascript">
var app = angular.module('imageLoaderApp', []);
app.controller('loadController', function ($scope) {
console.log(`i'm here.'`);

When I'm hitting below url in browser


I'm getting below error in console:

enter image description here

This is happening with all the js files. I even tried to move the html and js files in main folder still getting the same error.

What am I doing wrong?


It looks like HTML1.html is in the client folder. If that is the case I think you need to put the path to the js relative to it so: 'src="scripts/angular.js"'