Skip to content
This repository has been archived by the owner on Mar 20, 2022. It is now read-only.

Error when using Express #9

Open
cohenerickson opened this issue Jan 28, 2022 · 3 comments
Open

Error when using Express #9

cohenerickson opened this issue Jan 28, 2022 · 3 comments

Comments

@cohenerickson
Copy link

/home/runner/Palladium/lib/server/index.js:20
if (server!={}) server.on('request', (req, res) => {if(req.headers.useragent === 'googlebot') return res.writeHead(403).end('');})
^

TypeError: server.on is not a function
at new Smoke (/home/runner/Palladium/lib/server/index.js:20:28)
at Object. (/home/runner/Palladium/examples/express-server/index.js:6:15)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47

@VasukipriyaKN
Copy link

try this

const server = http.createServer();
server.on('request', (request, response)

@s-tn
Copy link
Collaborator

s-tn commented Jan 30, 2022

replace the server.on(“request”, (... with
server.use(...

@s-tn
Copy link
Collaborator

s-tn commented Jan 30, 2022

Don’t include the “request”

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants