1.1.0 • Published 5 months ago

ptm-nodeserver v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Node Js Dev Server with routes

Simple Node Js native server

nodeserver


Install

npm i ptm-nodeserver

Usage

import devserver from "ptm-nodeserver";

const routes = [
    { route: '/',  path: '.'},// For root path
    { route: '/app',  path: './app'},
    
];
const app = devserver(routes);
const port = 5040;

app.listen(port, () => {
    console.log(`Server running on http://localhost:${port}`);
});

Routes

const routes = [
    { route: '/',  path: '.'},// For root path
    { route: '/app',  path: './app'},
    
];
/*--------------------------------------------------------------------------*/
// { route: '/',  path: '.'} for project root index.html
// http://localhost:5040/app ---- index.html
// http://localhost:5040/app/foo.html
// http://localhost:5040/app/img.jpg
// http://localhost:5040/app/index.css
// http://localhost:5040/app/index.js

1.1.0

5 months ago

1.0.1

6 months ago

1.0.0

6 months ago