Skip to content

Commit f5c2d75

Browse files
committed
chore: tidy up unnecessary imports and conventions, use more relevant and readable express methods
1 parent f3bcce2 commit f5c2d75

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
const http = require('http');
21
const express = require('express');
3-
const MessagingResponse = require('twilio').twiml.MessagingResponse;
2+
const { MessagingResponse } = require('twilio').twiml;
43

54
const app = express();
65

@@ -9,10 +8,9 @@ app.post('/sms', (req, res) => {
98

109
twiml.message('The Robots are coming! Head for the hills!');
1110

12-
res.writeHead(200, {'Content-Type': 'text/xml'});
13-
res.end(twiml.toString());
11+
res.type('text/xml').send(twiml.toString());
1412
});
1513

16-
http.createServer(app).listen(1337, () => {
17-
console.log('Express server listening on port 1337');
14+
app.listen(3000, () => {
15+
console.log('Express server listening on port 3000');
1816
});

0 commit comments

Comments
 (0)