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

272
Views
NodeJS: Why do I keep getting Cannot GET/

I am currently trying to make a webapp that uses the darksky api to pull weather data. I have the basic functionality done, but when I try to run it on port 3000, I get "Cannot GET/". I am quite new to using node and backend servers as a whole so I don't know how to debug this. I will paste my code below.

    const express = require("express");
const unirest = require("unirest");
const credentials = require('./apiCredentials.json'); 
const app = express();
    app.use(express.static('/public')); // location of my index.html
    app.get('/weather', (req, res) => {
        const {lat,lon} = req.query;
        let request = unirest("GET",`https://${credentials.host}/${lat},${lon}`);
        request.query({
            lang:"en",
            units:"auto"
        });
        request.headers({
            "dark-sky.p.rapidapi.com": credentials.host,
            "466375f66bmsh72031b571ea7c30p1f704fjsnc527236c3565": credentials.apiKey
        });
        
        request.end(response => {
            if(response.error) res.status(500).end();
            const{
                summary,
                precipProbability,
                temperature,
                windSpeed,
                windBearing
            } = response.body.currently;
            res.status(200).send(
                JSON.stringify({
                    summary: summary,
                    chanceOfRain: precipProbability,
                    temp: temperature,
                    wind:{
                        speed: windSpeed,
                        bearing: windBearing
                    }
                })
            );
        });
    });
    app.listen(3000,()=>{
        console.info('Listening on port :3000');
    });
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!