I am trying to test if my serving is working on post man. I tried pasting this http://localhost:80/api/v1/
and i got, Cannot GET /api/v1/
On my terminal on vs code, it looks like the server is running because it showsLISTENING TO PORT: 80 db connected
.
here is my code
env file:
PORT=80MONGO_URL =myurl
routes/transaction.js:
const express = require('express');const router = express.Router();router.get('/', (req, res) => { res.send('Hello, world!');});module.exports = router;
index.js:
const express = require('express')const cors= require('cors')const { db } = require('./db/db')const {readdirSync} = require('fs')const app = express()require('dotenv').config()const PORT = process.env.PORT//midwares//data is in jsonapp.use(express.json())app.use(cors())//routesreaddirSync('./routes').map((route)=> app.use('/api/v1',require('./routes/'+ route)))const server = ()=>{ db() app.listen(PORT,()=>{ console.log('LISTENING TO PORT:',PORT); })}server()
I am using atlas, but I have also tried using mongoDB compass and i still get the same error