We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 956c796 commit 8556137Copy full SHA for 8556137
ja/connect/README.md
@@ -9,3 +9,4 @@ _middleware_という拡張する仕組みを持っていて、connectが持つ
9
10
## どう書ける?
11
12
+[import, connect-inline-example.js](../../src/connect/connect-inline-example.js)
src/connect/connect-inline-example.js
@@ -0,0 +1,18 @@
1
+"use strict";
2
+import assert from "assert";
3
+import connect from "connect";
4
+import http from "http";
5
+var app = connect();
6
+// add "X-Content-Type-Options" to response
7
+app.use(function (req, res, next) {
8
+ res.setHeader("X-Content-Type-Options", "nosniff");
+ next(); // => next middleware
+});
+// respond to all requests
+app.use(function (req, res) {
13
+ res.end("response text");
14
15
+//create node.js http server and listen on port
16
+http.createServer(app).listen(3000);
17
+
18
0 commit comments