Giter VIP home page Giter VIP logo

Comments (3)

lifehome avatar lifehome commented on July 21, 2024

I will get Error: getaddrinfo ENOTFOUND errror after below changes...
Any idea?


config.js:

"ipv6enable": true,
"host": "127.0.0.1",
"host6": "[::1]",
"port": 1234,

server.js:

if(config.ipv6enable) config.host6 = process.env.HOST || config.host6 || '[::1]';
...
...
if(config.ipv6enable){connect.createServer(
  // First look for api calls
  connect.router(function(app) {
    // get raw documents - support getting with extension
    app.get('/raw/:id', function(request, response, next) {
      var skipExpire = !!config.documents[request.params.id];
      var key = request.params.id.split('.')[0];
      return documentHandler.handleRawGet(key, response, skipExpire);
    });
    // add documents
    app.post('/documents', function(request, response, next) {
      return documentHandler.handlePost(request, response);
    });
    // get documents
    app.get('/documents/:id', function(request, response, next) {
      var skipExpire = !!config.documents[request.params.id];
      return documentHandler.handleGet(
        request.params.id,
        response,
        skipExpire
      );
    });
  }),
  // Otherwise, static
  connect.staticCache(),
  connect.static(__dirname + '/static', { maxAge: config.staticMaxAge }),
  // Then we can loop back - and everything else should be a token,
  // so route it back to /index.html
  connect.router(function(app) {
    app.get('/:id', function(request, response, next) {
      request.url = request.originalUrl = '/index.html';
      next();
    });
  }),
  connect.static(__dirname + '/static', { maxAge: config.staticMaxAge })
).listen(config.port, config.host6);}
...
...
if(config.ipv6enable){winston.info('listening on ' + config.host6 + ':' + config.port);}

from haste-server.

neandrake avatar neandrake commented on July 21, 2024

To enable IPv6 I don't think you need any changes to server.js. Just modify the config.json host to use the IPv6 version of the address:

{
"host": "::1",
"port": 7777
}

I think the brackets you were using around the IPv6 version of the address were causing the errors.

from haste-server.

Logic-gate avatar Logic-gate commented on July 21, 2024

Thanks @neandrake.

from haste-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.