ptm-nodeserver
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i ptm-nodeserver

Weekly Downloads

4

Version

1.1.0

License

MIT

Unpacked Size

5.74 kB

Total Files

6

Last publish

Collaborators

  • phothin