Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 导入node.js http模块
const http = require('http');
// 创建http server 对象;
const server = http.createServer((req,res)=>{
console.log("server start.....");
});
// 启动server 监听端口;
server.listen(8080);
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);
});
}
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);
}
}
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);
}
});
});
})
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);
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);
const http = require('http')
const server = http.createServer((req, res) => {
res.writeHead(301, {
Location: 'https://www.example.com/'
})
res.end()
})
server.listen(8080)
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)
})
}
function startServer() {
var app = Router();
app.addRoute('/*', st({
path: __dirname + '/',
url: '/',
index: 'index.html'
}));
server = http.createServer(app);
server.listen(9000);
return server;
}
function startServer() {
var app = Router();
app.addRoute('/*', st({
path: __dirname + '/',
url: '/',
index: 'index.html'
}));
server = http.createServer(app);
server.listen(8080);
return server;
}