INNER CODE UNIT · JavaScript

server

open-quantum-safe/oqs-demos · nodejs/testserver.js:14

const server = http2.createSecureServer(options, (req, res) => {
  if (req.url === '/hello') {
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    res.end('Hello World!\n');
  } else if (req.url === '/exit') {
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    res.end('Terminating Server\n');
    setImmediate(() => {exit(0)});

  } else {
    res.writeHead(404, { 'Content-Type': 'text/plain' });
    res.end('Not Found');
  }
});

server.listen(port, () => {
    console.log('Server running at https://localhost:' + port);
});

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…