summaryrefslogtreecommitdiff
path: root/evals/fixtures/browser-testing-with-devtools/server.js
blob: 53c271786155b7f29ad4e51e3b063c1471e8ad52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'use strict';

const fs = require('node:fs');
const http = require('node:http');
const path = require('node:path');

http.createServer((req, res) => {
  if (req.url === '/api/signup') {
    res.writeHead(500, { 'content-type': 'text/html' });
    res.end('<h1>database unavailable</h1>');
    return;
  }
  res.writeHead(200, { 'content-type': 'text/html' });
  res.end(fs.readFileSync(path.join(__dirname, 'index.html')));
}).listen(4173, '127.0.0.1', () => console.log('listening on http://127.0.0.1:4173'));