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

130
Views
Express app (with TypeScript ) not responding to routes

I have the following problem :

Im making a rest api but my app doesnt even go into the actions when I make a request to the endpoint ?

This is my server setup

import express, { Express } from 'express';
import cookieParser from 'cookie-parser';
import cors from 'cors';
import characterRouter from '../modules/character/router';
import userRouter from '../modules/user/router';
import itemsRouter from '../modules/item/router';

require('dotenv').config();

const app: Express = express();

app.use(cors);

//Setup cookieParser and public folder
app.use(cookieParser());

//Setup bodyParser
app.use(express.json());
app.use(express.urlencoded({ extended: false }));

app.get('/items', (req, res) => {
    console.log('OK');
    res.json({ ok: true });
});

app.listen(3000, () => {
    console.log(`Server listnening on port ${process.env.SERVER_PORT}`);
});

Its my first time using the import syntax could it possibly be because of it ?

When I make a request GET localhost:3000/items it doesnt even go to the console.log

Tsconfig.json :

{
    "compilerOptions": {
        "target": "es2016",
        "module": "commonjs",
        "outDir": "./dist",
        "esModuleInterop": true, 
        "forceConsistentCasingInFileNames": true,
        "strict": true, 
        "skipLibCheck": true,
    }
}

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

import express, { Express } from 'express';
import cookieParser from 'cookie-parser';
import cors from 'cors';
import characterRouter from '../modules/character/router';
import userRouter from '../modules/user/router';
import itemsRouter from '../modules/item/router';

require('dotenv').config();

const app: Express = express();

app.use(cors);

//Setup cookieParser and public folder
app.use(cookieParser());

//Setup bodyParser
app.use(express.json());
app.use(express.urlencoded({ extended: false }));

// You missing
app.use('/', indexRouter);
app.use('/users', usersRouter);

app.get('/items', (req, res) => {
    console.log('OK');
    res.json({ ok: true });
});

app.listen(3000, () => {
    console.log(`Server listnening on port ${process.env.SERVER_PORT}`);
});
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!