I'm exploring and testing nodejs with a html, css and javascript.
When i run index.html locally (no webserver) I can see the css,js,html,images render properly on my browser.
The problem when I create server.js and browse localhost:8000/index.html, it just return my heading and paragraph... no nice images, css, js execute...
I have gone through from SO and due to calling is only on html file but not css/js/images.
I don't know what's the problem, and how to proceed further.
This is my server.js:
var express = require('express');
var connect = require('connect');
var http = require('http');
var path = "";
var app = connect().use(express.static(__dirname + path));
http.createServer(app).listen(8000);
This is my index.html:
<!DOCTYPE html>
<html>
<head>
<title>TEST NODEJS WEB</title>
<!-- library -->
<link rel="stylesheet" href="/home/xero/next/css/next.min.css">
<script type="text/javascript" src="/home/xero/next/js/next.min.js">
</script>
<!-- Font Awesome -->
<link rel="stylesheet" href="/home/xero/next/font-
awesome/css/font-awesome.min.css">
</head>
<body>
<div id="topology-container"></div>
<!-- Application scripts -->
<script type="text/javascript" src="topology_data.js"></script>
<script type="text/javascript" src="action-panel.js"></script>
<script type="text/javascript" src="topology.js"></script>
<script type="text/javascript" src="main.js"></script>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
This is folder structure in my machine:
home
xero
next
js/next.min.js
css/next.min.css
myweb
index.html
topology_data.js
action-panel.js
topology.js
main.js
server.js
When i browse index.html..only can see 'My First Heading' and 'My first paragraph.'
Please help and advise me further. Thank you. Thanks to all
server.jswhich handles any incoming request, So how you are gonna get the HTML file?