-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
else if (endpoint === 'create-user') {
// Read html form request data using a Stream
let body = '';
request.on('data', (chunk) => body += chunk);
request.on('end', () => {
const { name, location } = querystring.parse(body);
addData(name, location, (err, res) => {
if (err) {
response.writeHead(303, {'Location': '/'});
response.writeHead(500, {'content-type': 'text/plain'});
response.end('Something went wrong');
} else {
response.writeHead(200, {'content-type': 'text/plain'});
response.writeHead(303, {'Location': '/'});
response.end(`Successfully added ${name}`);
}
});
})
}Reactions are currently unavailable