Skip to content

Commit

Permalink
Lint Socket.IO Example (#341)
Browse files Browse the repository at this point in the history
* Remove useless function and lint index.js

* Perform package.json of socketio example
  • Loading branch information
fmiras authored and timneutkens committed Feb 14, 2018
1 parent 14b097a commit 1248351
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 26 deletions.
23 changes: 11 additions & 12 deletions 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)
26 changes: 12 additions & 14 deletions 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"
}
}

0 comments on commit 1248351

Please sign in to comment.