exports.usecontroller=((req,res)=>{
const use=new Object({
name:'Muxammadali',
fullname:'Xolmominov',
age:20,
job:'talaba'
})
res.status(201).json({
succes:true,
data:use
})
})
const express=require('express');
const rout=express.Router();
const router=require('./controller');
rout.get('/street',(req,res)=>{
res.send("laa tahzan innallohu manaa")
})
rout.post('/road',(req,res)=>{
res.send("sog'ayib keting in shaa Alloh ustoz")
})
module.exports=rout;
const express= require('express');
const app=express();
const PORT=5000;
const app1=require('./router')
app.get('/',(req,res)=>{
res.send('the best')
})
app.use('/road',app1)
app.listen(PORT,()=>{
console.log(`this project is running ${PORT}`)
})
Do'stlaringiz bilan baham: |