Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 486 Bytes

README.md

File metadata and controls

25 lines (16 loc) · 486 Bytes

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);