Last active
July 20, 2022 02:55
-
-
Save milhidaka/9984ea6464ec312d2cc51751a9ee50e0 to your computer and use it in GitHub Desktop.
COEPヘッダ付き開発用HTTPサーバ (SharedArrayBuffer等の検証)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const PORT = 8080; | |
app.use(express.static('public', { | |
setHeaders: function (res, path) { | |
// no allow cache | |
res.set("Cache-Control", "no-cache"); | |
// CORS | |
res.set("Access-Control-Allow-Origin", "*"); | |
res.set("Access-Control-Allow-Methods", "GET,POST,HEAD,OPTIONS"); | |
// COEP | |
res.set("Cross-Origin-Embedder-Policy", "require-corp"); | |
res.set("Cross-Origin-Opener-Policy", "same-origin"); | |
} | |
})); | |
app.listen(PORT, () => console.log(`Server listening on port: ${PORT}`)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "sampleserver", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"serve": "node index.js" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "CC0", | |
"devDependencies": { | |
"express": "^4.18.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment