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

133
Views
Server is loading forever as I use the following code for server.js

I have used this code in server.js file and the main code in app.js in folder called website. when i run localhost using node server.js in terminal and run http://localhost:3000 in browser, it is loading forever with no stopping.

const bodyParser=require('body-parser');
const express=require('express');
const app=express();
/*dependencies*/
//Here we are configuring express to use body-parser as middle-ware.
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
//cors for cross origin allowance
const cors=require('cors');
app.use(cors);
//making a local server
const port= 3000;
const server = app.listen(port, ()=>{console.log(`running on localhost: ${port}`)});
app.use(express.static('website'));
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Remove the CORS module. You probably don't need it and its the reason for the infinite loading. If you need it, you should probably search for a different module.

about 4 years ago · Juan Pablo Isaza Report
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!