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
- WordPress is removing http:// from my urls
- How to make a discord bot create an invite for every server it joins?
- What is the difference between POST and PUT in HTTP?
- What is the difference between POST and PUT in HTTP?
- map function for objects (instead of arrays)
- I can´t install nodemon globally, “nodemon” not recognized
- SOAP vs REST (differences)
- How can I update NodeJS and NPM to the next versions?
- How can I update npm itself?
- How do I update Node.js?
- How to install a previous exact version of a NPM package?
- How to fix ‘Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.’
- How to fix ‘Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.’
- How to solve npm error “npm ERR! code ELIFECYCLE”
- Start script missing error when running npm start
- How to solve npm error “npm ERR! code ELIFECYCLE”
- npm check and update package if needed
- What is the file node.exe for?
- Node.js version on the command line? (not the REPL)
- Can not find module “@angular-devkit/build-angular”
- Node.exe Stuck at 100% CPU
- After command npm start “Missing script:start” error
- sudo: npm: command not found
- How can a Discord bot create a hyperlink in a Discord message in an embed or in general? [closed]
- Chrome hangs after certain amount of data transfered – waiting for available socket
- Discord API error when trying to send one command at discord using JavaScript client
- How to you store data for each discord user in the discord server?
- Upgrading Node.js to latest version
- Use of PUT vs PATCH methods in REST API real life scenarios
- How to resolve Nodejs: Error: ENOENT: no such file or directory
- bash: npm: command not found?
- Babel 6 regeneratorRuntime is not defined
- TypeError: Converting circular structure to JSON in nodejs
- Babel 7 – ReferenceError: regeneratorRuntime is not defined
- How to redirect all HTTP requests to HTTPS
- Node.js getaddrinfo ENOTFOUND
- How do I debug error ECONNRESET in Node.js?
- How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
- Node.js getaddrinfo ENOTFOUND
- How do I debug error ECONNRESET in Node.js?
- Getting a UnhandledPromiseRejectionWarning when testing using mocha/chai
- How to fix “ReferenceError: primordials is not defined” in Node.js
- Does anyone knows what “rimraf” means?