1.0.0 • Published 3 years ago

normalize-path-express v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

randomt hing i md efor my website makes pat h normal in express

express.static() may infinite redirect because express.static() adds "/" to the path for directories

✔ add { redirect: false } as an option to disabled this so it look like express.static(path, { redirect: false })

const normalize = require("normalize-path");
const express = require("express");

const app = express();
app.use(normalize);

app.get("/users/:id");
/*
Valid paths:
  //////users////296776625432035328///////
  /users/296776625432035328//////
*/

app.get("/param/another");
/*
Valid paths:
  /param/another/
  //////param//////another/////
*/

app.get("/");
/*
Valid paths:
  //////
  /
*/

app.listen(3000);