Questions tagged [node-static]

a simple, rfc 2616 compliant file streaming module for node.js

node-static is a simple, rfc 2616 compliant file streaming module for node.js

24 questions
4
votes
2 answers

Node.js Simple Server Request End Event Issue

I'm new to node.js. Trying to get a console to print when the request ends. I try to go to localhost:8080 and also localhost:8080/ but nothing prints in the terminal. Any idea why? Doing this because when I run this example because when I try to run…
Ben Scheib
  • 392
  • 1
  • 3
  • 16
4
votes
3 answers

Node-static example

I've been banging my head against the wall trying to figure out what's wrong with this code. I copied it directly from the node-static github repository example, but it doesn't seem to work. The only modification that I made was to the path of…
Seth Moore
  • 3,575
  • 2
  • 23
  • 33
2
votes
1 answer

Using node-static and journey together

I'm using Node.js for the first time. I'm serving up static files with node-static and routing with journey. Unfortunately the two seem to conflict with each other, and I'm not sure of the best way to stop the conflict. My server looks like…
Skilldrick
  • 69,215
  • 34
  • 177
  • 229
2
votes
0 answers

Serving static files in Node.js using node-static

I put together a rudimentary Node app and am trying to avoid unnecessary dependencies (most notably express) for educational purposes. However, I've been running into an issue trying to serve up static files such as images or css. For security…
dontmitch
  • 95
  • 1
  • 6
2
votes
1 answer

node-static cannot serve a folder above current folder

I don't know if this is a limitation to node-static or is it a bug in my code, but I can't seem to get it to serve files above or beyond the current directory. My current directory structure is this: project public ...public stuff…
Joseph
  • 117,725
  • 30
  • 181
  • 234
1
vote
1 answer

Serve Static Files from Node.js with POST data

I run a node.js server, and use node-static to serve static HTML files. var nodeStatic = require('node-static'); var file = new nodeStatic.Server('./public'); .. file.serveFile('/file.html', 500, {}, request, response); What i would like to do is,…
evsc
  • 260
  • 3
  • 10
1
vote
1 answer

node-static add headers via cli

I have a question about cli use of the node-static library. I can go to a folder and just run static. Which serves the directory on port 8080. I can see that -H is the option to format but I'm not sure how to pass in the options. Here is what I'm…
Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225
1
vote
1 answer

How to serve static files in node.js after renaming them?

I am creating a node.js app in which user can upload files and can download later. I am storing file information (original file name that user uploaded, ...) in mongodb document and named that file same as mongodb document id. Now i want my user to…
1
vote
2 answers

NodeJS using node-static and restify together

I'm creating a simple testing platform for an app and have the following code setup as my server.js file in the root of my app: var restify = require('restify'), nstatic = require('node-static'), fs = require('fs'), data = __dirname +…
Fluidbyte
  • 5,162
  • 9
  • 47
  • 76
0
votes
1 answer

Node static serve different index.html for a certain IP address

I am using node static for a really simple web app. I need to server a different index.html for a certain client IP. This is my code atm.: var fileServer = new(nodeStatic.Server)(); var app = http.createServer(options, function(req, res) { //…
Roman
  • 3,563
  • 5
  • 48
  • 104
0
votes
1 answer

In Node.js is it possible to create a virtual folder if so how

In Node.js is it possible to create a virtual folder if so how? Some context for needing a virtual folder: Have a project in Node.js that is a middleware is listinning to port 400 for example so can make request to my endpoints as follow…
H.C
  • 565
  • 7
  • 28
0
votes
1 answer

Localhost page cannot be found using node-static

I am trying to serve static files using node-static. Later I intend to run this as Windows service using nssm. I have run this before but don't know why, it doesn't work now. Below is my code: var http = require('http'); var nStatic =…
Zankhana Rana
  • 169
  • 2
  • 16
0
votes
0 answers

How to cache AJAX results server-side in node.js

Apparently, express-static and buffet cache only static files in the server memory. Is there a middleware which will allow me to cache AJAX results in the server memory? I need this to be done because I am storing my images in MongoDB. Does the…
Chong Lip Phang
  • 8,755
  • 5
  • 65
  • 100
0
votes
5 answers

Serve html file in nodejs server

I've been doing fine until I try to separate my code into routes, controllers and etc. Now I'm getting an error when I try to load the html file. When I go to the link http://localhost:3000/ I'm getting this error Error: ENOENT: no such file or…
Thidasa Pankaja
  • 930
  • 8
  • 25
  • 44
0
votes
1 answer

Getting the Server.serve status code using node-static in Typescript

I'm trying to write some of the node-static example code in Typescript and I'm getting the error Property 'status' does not exist on type 'Error' Here is my code with the error import * as server from 'node-static'; import * as http from…
user3628387
  • 139
  • 1
  • 2
  • 9
1
2