Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const express = require('express');
  2. const router = express.Router();
  3. const dirTree = require("directory-tree");
  4.  
  5.  
  6. router.get("/:filePath", (req, res, next) => {
  7.     const path = req.params.filePath
  8.     const tPath = path.replace("+","/")
  9.     const tree = dirTree(`/home/cameron/TestRestApi/api/stoage/${tPath}`);
  10.         res.status(200).json(tree)
  11. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement