Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error anywhere not function #2

Open
bobwatcherx opened this issue Dec 25, 2023 · 0 comments
Open

error anywhere not function #2

bobwatcherx opened this issue Dec 25, 2023 · 0 comments

Comments

@bobwatcherx
Copy link

C:\Users\LENOVO\Pictures\mainan\corsany\api\index.js:14
.use('/cors-anywhere', anywhere())
^

TypeError: anywhere is not a function
at C:\Users\LENOVO\Pictures\mainan\corsany\api\index.js:14:30
at new Promise ()
at C:\Users\LENOVO\Pictures\mainan\corsany\api\index.js:11:9
at Object. (C:\Users\LENOVO\Pictures\mainan\corsany\api\index.js:18:3)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49

code
const express = require('express');
const axios = require('axios');
const { json } = require('body-parser');
const anywhere = require('express-cors-anywhere');

const { PORT } = process.env;
const port = PORT || 3000;

(async () => {
/* configure cors */
await new Promise(resolve =>
express()
.use(json())
.use('/cors-anywhere', anywhere())
.get('/hello', (_, res) => res.status(200).send('Hi!'))
.listen(port, resolve)
);
})();

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

No branches or pull requests

1 participant