Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
Solicitud de obtención de CORS en Heroku

Tengo un problema de cors en mi código aunque no hubo problemas cuando todo se ejecutaba en el host local

Código en el servidor

 import bodyParser from 'body-parser'; import bcrypt from 'bcrypt-nodejs'; import cors from 'cors'; import knex from 'knex'; import handleRegister from './controllers/register.js'; import handleSignin from './controllers/signin.js'; import handleProfileGet from './controllers/profile.js'; import {handleImage, handleApiCall} from './controllers/image.js'; const db = knex({ client: 'pg', connection: { connectionString: process.env.DATABASE_URL, ssl: { rejectUnauthorized: false } }); const app = express(); app.use(bodyParser.json()); app.use(cors( origin: '*', credentials:true )); app.get('/', (req,res) => {res.send('it is working')}) app.post('/signin', (req, res) => { handleSignin(req, res, db, bcrypt) }) app.post('/register', (req, res) => { handleRegister(req, res, db, bcrypt) }) app.get('/profile/:id', (req, res) => { handleProfileGet(req, res, db)}) app.put('/image', (req, res) => { handleImage(req, res, db)}) app.post('/imageurl', (req, res) => { handleApiCall(req, res)}) app.listen(process.env.PORT || 3000, () => { console.log(`app is running on port ${process.env.PORT}`); })

mi solicitud de publicación

 onSubmitSignIn = () => { fetch('https://intense-lowlands-80632.herokuapp.com/signin', { method:'post', headers:{'Content-Type': 'application/json'}, body:JSON.stringify({ email: this.state.signInEmail, password: this.state.signInPassword }) }) .then(response => response.json()) .then(user => { if (user.id) { this.props.loadUser(user) this.props.onRouteChange('home') } }) }

error

2021-09-21T10:03:17.603744+00:00 heroku[router]: at=código de error=H10 desc="Aplicación bloqueada" method=OPTIONS path="/signin" host=intense-lowlands-80632.herokuapp.com request_id=b146be27-0bd2-43ac-bcb9-b0661e6a3085 fwd="188.25.95.60" dyno= conectar= servicio= estado=503 bytes= protocolo=https

error de la consola

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!