-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Balance not showing in the get request in account/balance #32
Comments
can u please provide your accounts file. above code does not have any kind of get request in account/balance. |
Push the code to GitHub and send the repo link Happy to check the issue and resolves it |
Hi yesahem , I hope you're doing well. I have pushed the latest code to the repository. You can check it out here: https://github.com/baldanaresh/Paytm-basic.git Thank you so much for your attention to this issue. Please take a look and let me know if you encounter any problems or have further questions. |
Hey Naresh, I am pushing the code feel free to review it and merge it For any query feel free to ping me on twitter : https://x.com/heyshishu |
the error im getting is :SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at createStrictSyntaxError (C:\Users\nares\OneDrive\Desktop\Paytm\paytm\backend\node_modules\body-parser\lib\types\json.js:160:10)
at parse (C:\Users\nares\OneDrive\Desktop\Paytm\paytm\backend\node_modules\body-parser\lib\types\json.js:83:15)
at C:\Users\nares\OneDrive\Desktop\Paytm\paytm\backend\node_modules\body-parser\lib\read.js:128:18
at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
at invokeCallback (C:\Users\nares\OneDrive\Desktop\Paytm\paytm\backend\node_modules\raw-body\index.js:231:16)
at done (C:\Users\nares\OneDrive\Desktop\Paytm\paytm\backend\node_modules\raw-body\index.js:220:7)
at IncomingMessage.onEnd (C:\Users\nares\OneDrive\Desktop\Paytm\paytm\backend\node_modules\raw-body\index.js:280:7)
at IncomingMessage.emit (node:events:514:28)
at endReadableNT (node:internal/streams/readable:1359:12)
My code:const express=require("express");
const router=express.Router();
const zod=require("zod");
const {user}=require("../db");
const jwt=require("jsonwebtoken");
const {JWT_SEC}=require("../config");
const {authMiddleware}=require("../middleware")
const signupSchema=zod.object({
username:zod.string().email(),
password:zod.string(),
firstname:zod.string(),
lastname:zod.string(),
});
router.post("/signup",async(req,res)=>{
const body=req.body;
const {success}=signupSchema.safeParse(req.body);
if(!success){
return res.status(400).json({
message:" incorrect inputs"
})
}
const existingUser= await user.findOne({
username:body.username
})
if(existingUser){
return res.status(409).json({
message:"Email already taken"
})
}
});
const signinBody = zod.object({
username: zod.string().email(),
password: zod.string()
})
router.post("/signin",async(req,res)=>{
const body=req.body;
const {success}=signinBody.safeParse(body);
if(!success){
return res.status(400).json({
message:" incorrect inputs"
})
}
const userRecord = await user.findOne({
username: req.body.username,
password: req.body.password
});
})
const updateBody = zod.object({
password: zod.string().optional(),
firstName: zod.string().optional(),
lastName: zod.string().optional(),
})
router.put("/", authMiddleware, async (req, res) => {
const { success } = updateBody.safeParse(req.body)
if (!success) {
res.status(400).json({
message: "Error while updating information"
})
}
})
router.get("/bulk", async (req, res) => {
const filter = req.query.filter || "";
})
module.exports=router;
The text was updated successfully, but these errors were encountered: