From 2f3322c919a4f346004addd7bab4f98d8f1b787f Mon Sep 17 00:00:00 2001 From: Federico Miras Date: Wed, 14 Feb 2018 15:00:42 -0300 Subject: [PATCH 1/2] Remove useless function and lint index.js --- examples/socket.io-chat-app/index.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/examples/socket.io-chat-app/index.js b/examples/socket.io-chat-app/index.js index b46f2c57..522baf41 100644 --- a/examples/socket.io-chat-app/index.js +++ b/examples/socket.io-chat-app/index.js @@ -1,19 +1,18 @@ -const micro = require('micro'), - fs = require('fs'); +const micro = require('micro') +const fs = require('fs') +const path = require('path') -const html = fs.readFileSync(__dirname + '/index.html') +const document = path.join(__dirname, 'index.html') +const html = fs.readFileSync(document) const server = micro(async (req, res) => { - console.log('Serving index.html'); - res.end(html); -}); + console.log('Serving index.html') + res.end(html) +}) -const io = require('socket.io')(server); +const io = require('socket.io')(server) // socket-io handlers are in websocket-server.js -require('./websocket-server.js')(io); +require('./websocket-server.js')(io) -server.listen(4000); - -// Micro expects a function to be exported -module.exports = () => console.log('YOLO'); +server.listen(4000) From 989164802d3fb4e15081a6f1ff4bd7779de35eeb Mon Sep 17 00:00:00 2001 From: Federico Miras Date: Wed, 14 Feb 2018 15:01:01 -0300 Subject: [PATCH 2/2] Perform package.json of socketio example --- examples/socket.io-chat-app/package.json | 26 +++++++++++------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/examples/socket.io-chat-app/package.json b/examples/socket.io-chat-app/package.json index 2a489eb0..c56235a8 100644 --- a/examples/socket.io-chat-app/package.json +++ b/examples/socket.io-chat-app/package.json @@ -1,16 +1,14 @@ { - "name": "chatnow", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "start": "node index.js" - }, - "author": "Lucas Kostka", - "license": "ISC", - "dependencies": { - "micro": "latest", - "socket.io": "^1.7.3" - } + "name": "chatnow", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "start": "node ." + }, + "author": "Lucas Kostka", + "license": "ISC", + "dependencies": { + "micro": "latest", + "socket.io": "1.7.3" + } } -