Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge #27

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# starter-micro-api

This is the simplest possible nodejs api using the base http library that responds to any request with:
This is the simplest possible nodejs api using the base http library that responds to any request with:

```
Yo!
Hello!
```

## Deploy in under 10 seconds

[![Deploy to Cyclic](https://deploy.cyclic.app/button.svg)](https://deploy.cyclic.app/)
- Sets up instant continuous deployment on `git push`
- Realtime backend logs and API request monitoring

- Sets up instant continuous deployment on `git push`
- Realtime backend logs and API request monitoring
19 changes: 13 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
var http = require('http');
http.createServer(function (req, res) {
console.log(`Just got a request at ${req.url}!`)
res.write('Yo!');
res.end();
}).listen(process.env.PORT || 3000);
import { createServer } from 'http'
import { Server } from 'socket.io'

const httpServer = createServer()
const io = new Server(httpServer, {
// options
})

io.on('connection', (socket) => {
// ...
})

httpServer.listen(3000)
236 changes: 236 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"socket.io": "^4.7.2"
}
}