express-origin

0.0.2 • Public • Published

Useless

This package is useless, you can do what it does simply by adding / before file path. Watch this video to see an example:

Access files in root from children route

Install

npm i express-origin --save

Usage

var express = require('express');
var expressOrigin = require('express-origin');
 
var app = express();
app.use(expressOrigin());

Now You have:

app.get('/article/sport/:id',function (req, res, next) {
    // req.origin = /../../..
})

You can pass it to views to make paths relative to your domain name, Eg:

script(src= req.origin + "/js/main.js")

Will Give:

<script src="www.example.com/js/main.js" ></script>

Readme

Keywords

Package Sidebar

Install

npm i express-origin

Weekly Downloads

2

Version

0.0.2

License

ISC

Last publish

Collaborators

  • burawi