2

For example when I write <script src=files/script.js></script> in HTML document it dosen't work, but in site folder files exists.

2
  • 1
    What do you mean by "it doesn't work"? Commented Jun 19, 2011 at 10:20
  • Browser get 404 error instead of files/script.js file. Commented Jun 19, 2011 at 13:50

2 Answers 2

3

If you're using express you need to assign a folder as the public folder

eg

server.use(express.static(__dirname + '/public'));
Sign up to request clarification or add additional context in comments.

2 Comments

Can I do it only with default modules? And I would like to get link on a article with detail description of actions that i need to do (or only detail description without link =) ).
@user805222 unsure what you're asking but it's definitely a different question. You should flesh out your questions with code samples and just other information as it's hard to know what kind of answer you're looking for. If you're looking for a node.js server tutorial just google it...
0

SIMPLEST WAY

npm install statik

var statik = require('statik');
statik({
    port: 1337,
    root: '/Users/<yourUserName>/Downloads/DurandalJS/HTMLStarterKit'
});

In your browser: http:// yourLocalhost :1337/index.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.