-
Notifications
You must be signed in to change notification settings - Fork 457
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove useless function and lint index.js * Perform package.json of socketio example
- Loading branch information
1 parent
14b097a
commit 1248351
Showing
2 changed files
with
23 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} | ||
|