DEV Community

kidd-creator
kidd-creator

Posted on

Top 3: Packages that you may love

1. Express Js

installation

npm i express
Enter fullscreen mode Exit fullscreen mode

OR

yarn add express
Enter fullscreen mode Exit fullscreen mode

usage

const express = require("express")
const app = express()
app.get('/', (req, res) => res.send("Index Page"))
app.listen(3001)
Enter fullscreen mode Exit fullscreen mode

2. Multer

Makes file uploading super easy

npm i multer
Enter fullscreen mode Exit fullscreen mode

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>
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

3. nodemon

Actuallly this just helps you to restart your server evrytime you change something

installation

npm i nodemon --save-dev 
Enter fullscreen mode Exit fullscreen mode

OR

yarn add nodemon --dev
Enter fullscreen mode Exit fullscreen mode

usage

nodemon server.js
Enter fullscreen mode Exit fullscreen mode

Top comments (0)