Marwan Rabbaa
Marwan Rabbaa2w ago

Using express

Hi, I'm trying to use express with deno in https://github.com/the-benchmarker/web-frameworks/blob/master/javascript/express-deno/app.ts wuth the follwing command deno serve --parallel --port 3000 --allow-net --allow-read --allow-env app.ts. Is this somethinn doable ? Regards,
GitHub
web-frameworks/javascript/express-deno/app.ts at master · the-benc...
Which is the fastest web framework? Contribute to the-benchmarker/web-frameworks development by creating an account on GitHub.
2 Replies
Marwan Rabbaa
Marwan RabbaaOP2w ago
I found it : just use
import express from "express";
const app = express();
app.set("etag", false);

app.get("/", function (req, res) {
res.send("");
});

app.get("/user/:id", function (req, res) {
res.send(req.params.id);
});

app.post("/user", function (req, res) {
res.send("");
});

export default { fetch: app.listen }
import express from "express";
const app = express();
app.set("etag", false);

app.get("/", function (req, res) {
res.send("");
});

app.get("/user/:id", function (req, res) {
res.send(req.params.id);
});

app.post("/user", function (req, res) {
res.send("");
});

export default { fetch: app.listen }
I have tho
TypeError: Return value from serve handler must be a response or a promise resolving to a response
at mapped (ext:deno_http/00_serve.ts:409:15)
at eventLoopTick (ext:core/01_core.js:178:7)
TypeError: Return value from serve handler must be a response or a promise resolving to a response
at mapped (ext:deno_http/00_serve.ts:409:15)
at eventLoopTick (ext:core/01_core.js:178:7)
ioB
ioB2w ago
express with deno works the same way it works everyone else do not use the export serve syntax

Did you find this page helpful?