1. Express Js
installation
npm i express
OR
yarn add express
usage
const express = require("express")
const app = express()
app.get('/', (req, res) => res.send("Index Page"))
app.listen(3001)
2. Multer
Makes file uploading super easy
npm i multer
frontend
<form enctype="multipart/form-data"
action="http://localhost:3001/upload"
method="post">
<input type="file" name="uploaded file">
<input type="text">
<input type="submit" value="Submit!">
</form>
backend (javasript)
const express = require("express")
const multer = require("multer")
const app = express()
const storage = multer.diskStorage({
destination : (req, res, cb) => {
cb(null, './uploads')
}
})
app.post('/', multer({storage:storage}), (req, res) => {
console.log(req.file, req.body)
})
app.listen(3001)
3. nodemon
Actuallly this just helps you to restart your server evrytime you change something
installation
npm i nodemon --save-dev
OR
yarn add nodemon --dev
usage
nodemon server.js
Top comments (0)