Загрузка...

Create API use frontend form with image , nodejs , mongodb, express js, AI Windsurf vscode extension

vscode main extension main windsurf extenstion install usmain login and use like AI in vscode. ctrl+I se upper ai main jo cammand wahi code dega.
jahan cursor rakha wahi code likhega.

first give cammand use
npm i init -y
npm i cors multer nodemon dotenv express mongoose ejs body-parser

use express code this site
https://expressjs.com/en/starter/hello-world.html

config folder main database.js file main connect mongodb and export connectDB (database file ) and import in index.js file
models folder main nik.model.js file main mongoose schema
https://mongoosejs.com/docs/index.html
and export Nik6 and import in nik.route.js

.env file main port and mongodb_url and import in database.js dotenv.config() karke

uploads ka folder bana diya usmain image save ho.

routes folder main nik.routes.js file di and route diye get, post, put and delete ke and usmain search, pagination, image setting ki. and router export and import in index.js file main
https://www.npmjs.com/package/multer?activeTab=readme

frontend folder main index.js main frontend form banaya help of bootstrap
https://getbootstrap.com/docs/4.0/getting-started/introduction/
https://getbootstrap.com/docs/4.0/components/forms/
and usmain
search
table row naming
table data insert
view file model
add file model

enctype code dena add file model and edit file model main.yeh
enctype="multipart/form-data
enctype jaroor use karna hai create karte waqt.profile pic upload nahi hogi iske bina.

edit file model

script tag main edit pagination, search, view file, edit file, delete file, previous, next button and number button.

new bootstrap.modal() use in vie single file, edit box main, edit file

index.js file main multer error diya
https://stackoverflow.com/questions/30838901/error-handling-when-uploading-file-using-multer-with-expressjs
cmd main mongosh diya
show dbs
use nikform
show collections
db.nik6.insertOne({
firstName: "John",
lastName: "Doe",
profile_pic: "https://colorlib.com/wp/wp-content/uploads/sites/2/reg-form4.jpg"
});

postman main get, post , put, delete check
and localhost:3010/api/nik6?page=3 for page search
localhost:3010/api/nik6?search=niki for word se search

mongodb main database main nikform main nik6 main data aayega

webpage main form main view, edit, delete, add file seach, pagination sab chalega.

Видео Create API use frontend form with image , nodejs , mongodb, express js, AI Windsurf vscode extension канала Nikhil Verma
Яндекс.Метрика

На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.

Об использовании CookiesПринять