express-subdomains-middleware
v1.1.6
Published
A script that allows using subdomains in express.js
Downloads
38
Maintainers
Readme
express-subdomain
A script that allows using subdomains in express.js
Example
import {subdomain} from "express-subdomains-middleware";
import express from 'express';
const app = express();
const FrontEndRouter = subdomain("www",app);
const BackEndRouter = subdomain("api", app);
FrontEndRouter.static("./static");
BackEndRouter.get("/example", (req, res) => {
res.json({
text: 'This is a backend path'
})
})
app.listen(3000);