Skip to content

Commit 46209e0

Browse files
committed
feat(zeit): attempt to running the server on Now
1 parent 2c9599b commit 46209e0

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ After you have installed it, you need to start the `WebSocket` and you can do th
1111
# If everthing went sucessfuly, you must see the message:
1212
# "WebSocket server is running on :8008"
1313
# it means the server is running on "ws://localhost:8080"
14-
deno --allow-net ./web-socket-server/index.ts
14+
deno --allow-net ./web-socket-server/api/index.ts
1515
```
1616

1717
## Running WebSocket client with [React Native](https://facebook.github.io/react-native/)

web-socket-server/.nowignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
api/index.ts

web-socket-server/index.ts renamed to web-socket-server/api/handler.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
isWebSocketCloseEvent
55
} from "https://deno.land/std/ws/mod.ts";
66

7-
const handler = async (portArg: string) => {
7+
export const handler = async (portArg: string) => {
88
const port = Deno.args[1] || (typeof portArg === "string" ? portArg : "80");
99

1010
const connections = [];
@@ -53,6 +53,4 @@ const handler = async (portArg: string) => {
5353
clearInterval(intervalId);
5454
}
5555
});
56-
};
57-
58-
handler("8080");
56+
};

web-socket-server/api/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { handler} from './handler';
2+
3+
handler('8080');

web-socket-server/now.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"functions": {
3+
"api/handler.ts": {
4+
"runtime": "now-deno@0.1.0"
5+
}
6+
}
7+
}

0 commit comments

Comments
 (0)