diff --git a/javascript/routejs-uwebsocket/app.js b/javascript/routejs-uwebsocket/app.js index 09fdb5561f7..f16a50fa6f8 100644 --- a/javascript/routejs-uwebsocket/app.js +++ b/javascript/routejs-uwebsocket/app.js @@ -12,10 +12,11 @@ app .post("/user", (req, res) => res.end("")) .use((req, res) => res.writeStatus("404").end("")); +const handler = app.handler(); + uWS .App() .any("/*", (res, req) => { - const handler = app.handler(); handler(req, res); }) .listen(3000, () => { diff --git a/javascript/routejs-uwebsocket/package.json b/javascript/routejs-uwebsocket/package.json index 53d637fcca2..aaa01a309d3 100644 --- a/javascript/routejs-uwebsocket/package.json +++ b/javascript/routejs-uwebsocket/package.json @@ -1,7 +1,7 @@ { "dependencies": { "@routejs/router": "~2.1.0", - "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.20.0" + "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.23.0" }, "type": "module" } diff --git a/javascript/sifrr/package.json b/javascript/sifrr/package.json index 1d9828f4d0a..94ac5624eb5 100644 --- a/javascript/sifrr/package.json +++ b/javascript/sifrr/package.json @@ -2,6 +2,6 @@ "dependencies": { "@sifrr/server": "~0.0.6", "graphql": "*", - "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.20.0" + "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.23.0" } } diff --git a/javascript/uwebsockets/app.js b/javascript/uwebsockets/app.js new file mode 100644 index 00000000000..939c543c4e1 --- /dev/null +++ b/javascript/uwebsockets/app.js @@ -0,0 +1,19 @@ +import uWS from "uWebSockets.js"; + +uWS + .App() + .get("/", (res, req) => { + res.end(); + }) + .get("/user/:id", (res, req) => { + res.end(req.getParameter(0)); + }) + .post("/user", (res, req) => { + res.end() + }) + .any("/*", (res, req) => { + res.writeStatus("404").end(); + }) + .listen(3000, () => { + console.log("Server started on port 3000"); + }); diff --git a/javascript/uwebsockets/config.yaml b/javascript/uwebsockets/config.yaml new file mode 100644 index 00000000000..f54b323d79c --- /dev/null +++ b/javascript/uwebsockets/config.yaml @@ -0,0 +1,9 @@ +framework: + website: github.com/uNetworking/uWebSockets.js + version: 20.23.0 + +build_deps: + - git # required by uWebSockets.js + +bin_deps: + - gcompat # required by uWebSockets.js diff --git a/javascript/uwebsockets/package.json b/javascript/uwebsockets/package.json new file mode 100644 index 00000000000..3aea1defe2c --- /dev/null +++ b/javascript/uwebsockets/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.23.0" + }, + "type": "module" +}