@arunvaradharajalu/common.app-router
v1.2.1
Published
This package contains express application singleton router
Downloads
18
Maintainers
Keywords
Readme
@arunvaradharajalu/common.app-router
This package contains a singleton router for an express application.
Installation
To install the package, run:
npm install @arunvaradharajalu/common.app-router
Usage
Here is an example demonstrating how to use the singleton router in your Express application:
import express from 'express';
import { appRouter } from '@arunvaradharajalu/common.app-router';
const app = express();
// Mount the singleton router under '/api'
app.use('/api', appRouter);
// Define a sample route
appRouter.get('/example', (req, res) => {
res.send('Hello from the singleton router!');
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});
Scripts
The following npm scripts are available:
build
: Compile TypeScript usingtsc
.test
: Run tests usingjest
.
Running Tests
To run the tests, use:
npm test
The test results will be generated in an HTML report with the title "Decorator Test Report".
Repository
The source code is available at: GitHub Repository
Issues
If you encounter any issues, please report them at: GitHub Issues
Author
Arun Varadharajalu
License
This project is licensed under the ISC License.