This code should work:
var connect = require("connect"); var app = connect.createServer().use(connect.static(__dirname + '/public')); app.listen(8180);
Also in connect 2.0 .createServer() method deprecated. Use connect() instead.
var connect = require("connect"); var app = connect().use(connect.static(__dirname + '/public')); app.listen(8180);
Related Posts:
- Should a 502 HTTP status code be used if a proxy receives no response at all?
- What is the difference between a URI, a URL and a URN?
- HTTP Status 504
- What is the difference between POST and GET? [duplicate]
- Do I need Content-Type: application/octet-stream for file download?
- Problem HTTP error 403 in Python 3 Web Scraping
- application/x-www-form-urlencoded or multipart/form-data?
- Problem HTTP error 403 in Python 3 Web Scraping
- application/x-www-form-urlencoded or multipart/form-data?
- Is 418 “I’m a teapot” really an HTTP response code?
- How to define the basic HTTP authentication using cURL correctly?
- How to define the basic HTTP authentication using cURL correctly?
- “CAUTION: provisional headers are shown” in Chrome debugger
- What’s the difference between a POST and a PUT HTTP REQUEST?
- Error: No default engine was specified and no extension was provided
- Significance of port 3000 in Express apps
- How do I send a POST request with PHP?
- Why is it said that “HTTP is a stateless protocol”?
- What’s the difference between using application/csv vs text/csv? [duplicate]
- How to handle ETIMEDOUT error?
- How is an HTTP POST request made in node.js?
- What are all the possible values for HTTP “Content-Type” header?
- What is the difference between PUT, POST and PATCH?
- What could cause “connect ETIMEDOUT” error when the URL is working in browser?
- What’s the difference between “Request Payload” vs “Form Data” as seen in Chrome dev tools Network tab
- Exception in thread “main” java.net.NoRouteToHostException: No route to host
- ndroid 8: Cleartext HTTP traffic not permitted
- nodejs – first argument must be a string or Buffer – when using response.write with http.request
- Can PHP cURL retrieve response headers AND body in a single request?
- Setting Curl’s Timeout in PHP
- How are parameters sent in an HTTP POST request?
- Why am I suddenly getting a “Blocked loading mixed active content” issue in Firefox?
- wget: unable to resolve host address `http’
- Are HTTP headers case-sensitive?
- When looking at the differences between X-Auth-Token vs Authorization headers, which is preferred?
- WordPress HTTP parameter pollution
- Does WordPress send data about your blog to WordPress.org or Automattic?
- Hiding WordPress REST API v2 endpoints from public viewing
- Does WordPress only support HTTP 1.1?
- How do I troubleshoot responses with WP HTTP API?
- Is curl required?
- The resource was preloaded using link preload but not used within a few seconds
- using wp_remote_get to retrieve own url on local host
- Using wp-cron in backpress – problems with wp_remote_post, fsockopen error
- Running index.php from command line & load balancer health checks
- Enable CORS in wordpress
- Change port of wordpress
- How to get value of custom http header?
- Several times request to load plugins when sending one request
- why is $_REQUESt[‘redirect_to’] empty?
- Get “HTTP/1.1 406 Not Acceptable” when accesing my website with Delphi Indy Control
- WordPress HTTP 500 Error “page isn’t working”
- What’s the point in having “www” in a URL?
- For what is the “.well-known”-folder?
- Human readable format for http headers with tcpdump
- How to make wireshark filter POST-requests only?
- Image file urls still point to http instead of https
- What is the difference between POST and PUT in HTTP?
- How to fix ‘Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.’
- Node.js version on the command line? (not the REPL)
- node.js string.replace doesn’t work?
- require is not defined? Node.js
- What is “export default” in JavaScript?
- How to download a file over HTTP?
- What is NODE_ENV and how to use it in Express?
- Reactjs – Form input validation
- What is the difference between __dirname and ./ in node.js?
- How can the default node version be set using NVM?
- NPM ELIFECYCLE error – using node server.js command
- ‘npm’ is not recognized as internal or external command, operable program or batch file
- Node.js – SyntaxError: Unexpected token import
- Angular – ng: command not found
- PHP + curl, HTTP POST sample code?
- Node update a specific package
- Express error – TypeError: Router.use() requires middleware function but got a Object
- npm – “Can’t find Python executable “python”, you can set the PYTHON env variable.”
- NodeJS w/Express Error: Cannot GET /
- Why does JSHint throw a warning if I am using const?
- Difference between “module.exports” and “exports” in the CommonJs Module System
- node.js: cannot find module ‘request’
- How can I use webpack with express?
- Route.get() requires callback functions but got a “object Undefined”
- NPM self_signed_cert_in_chain
- How can I use an ES6 import in Node.js? [duplicate]
- How to stop Node.js server?
- unexpected strict mode reserved word — yield? Node v0.11, harmony, es6
- Nodejs – Redirect url
- ode.js vs. meteor.js what’s the difference?
- Can pm2 run an ‘npm start’ script
- nvm is not compatible with the npm config “prefix” option:
- Serving HTTP and HTTPS from one installation
- How can I change HTTP headers only to posts of a specific category from a plugin
- Can’t login to Dashboard when changing site URL to HTTPS
- Is it possible to access the wp-admin from one instance while keeping WP_HOME pointing to the balancing url?
- Allow non-SSL pages to use https or Force non-SSL pages to http?
- Implementing a URL Shortener
- Local WordPress with WAMP downloads files out of Nowhere
- Sudden Upload HTTP errors, PHP uploads and memory limits are already to high to my taste. Anything else?
- The plain HTTP request was sent to HTTPS port in wordpress [closed]
- How do you install Node.JS on CentOS?