How to use the http.createServer function in http

To help you get started, we’ve selected a few http examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Alexiuce / StatusBarDemoApp / Web / node入门 / 26-server.js View on Github external
// 导入node.js http模块
const http = require('http');
// 创建http server 对象;
const server = http.createServer((req,res)=>{
    console.log("server start.....");
});
// 启动server 监听端口;
server.listen(8080);
github TobiasWalle / rush / src / api / server / api-server.ts View on Github external
constructor(
    public host: string,
    public port: number
  ) {
    // Setup app
    const app = express();
    this.server = http.createServer(app);
    enableDestroy(this.server);

    // Setup main router
    this.router = new ApiRouter();
    app.use((req, res, next) => {
      this.router.route(req, res, next);
    });
  }
github collective-soundworks / soundworks / server / ioServer.es6.js View on Github external
init(app) {
    var server = http.createServer(app);

    server.listen(app.get('port'), function() {
      console.log('Server listening on port', app.get('port'));
    });

    this.server = server;

    if (server)
      this.io = new IO(server);
  }
}
github ccxt-rest / ccxt-rest / app.js View on Github external
oasTools.initialize(oasDoc, app, function() {
            server = http.createServer(app);
            server.listen(serverPort, function() {
              console.log("App running at http://localhost:" + server.address().port);
              console.log("________________________________________________________________");
              if (options_object.docs !== false) {
                console.log('API docs (Swagger UI) available on http://localhost:' + server.address().port + '/explorer');
                console.log("________________________________________________________________");
              }
              if (callback) {
                console.log('Server started. Invoking callback')
                callback(server);
              }
            });
          });
        })
github TheBrousse / TitaniumMobileHotshot / 07-SecondToLastFantasyOnlineServer / node_modules / socket.io / node_modules / policyfile / examples / basic.fallback.js View on Github external
var http = require('http')
  , fspfs = require('../');

var server = http.createServer(function(q,r){ r.writeHead(200); r.end(':3') }) 
  , flash = fspfs.createServer();

server.listen(8080);
flash.listen(8081,server);
github cdapio / cdap / server / cloud / node_modules / socket.io / node_modules / policyfile / examples / basic.fallback.js View on Github external
var http = require('http')
  , fspfs = require('../');

var server = http.createServer(function(q,r){ r.writeHead(200); r.end(':3') }) 
  , flash = fspfs.createServer();

server.listen(8080);
flash.listen(8081,server);
github kasha-io / puppeteer-prerender / examples / redirect-server.js View on Github external
const http = require('http')

const server = http.createServer((req, res) => {
  res.writeHead(301, {
    Location: 'https://www.example.com/'
  })
  res.end()
})

server.listen(8080)
github shuidi-fed / vuese / packages / cli / lib / server.ts View on Github external
export default async (config: CliOptions) => {
  const http = require('http')
  const handler = require('serve-handler')
  const server = http.createServer((req: any, res: any) => {
    return handler(req, res, {
      public: path.resolve(config.outDir)
    })
  })
  const port = config.port || (await getPort({ port: 5000 }))

  server.listen(port, config.host, () => {
    const addr = `http://${config.host}:${port}/`
    logger.success(`Server running at ${addr}`)
    if (config.open) open(addr)
  })
}
github angular / angular-hint / gulpfile.js View on Github external
function startServer() {
  var app = Router();
  app.addRoute('/*', st({
    path: __dirname + '/',
    url: '/',
    index: 'index.html'
  }));
  server = http.createServer(app);
  server.listen(9000);
  return server;
}
github radanalyticsio / oshinko-webui / bower_components / angular-hint / gulpfile.js View on Github external
function startServer() {
  var app = Router();
  app.addRoute('/*', st({
    path: __dirname + '/',
    url: '/',
    index: 'index.html'
  }));
  server = http.createServer(app);
  server.listen(8080);
  return server;
}

http

security holding package

Unknown
Latest version published 4 years ago

Package Health Score

50 / 100
Full package analysis