0.1.10 ā€¢ Published 3 years ago

dobject-routing v0.1.10

Weekly downloads
18
License
gpl-3.0
Repository
github
Last release
3 years ago

Use an object to declare your express routing.

Install

npm install dobject-routing express
npm install --save-dev @types/express

Usage

Install the package with express. Then you can create a routes file as an example

import { ERequestType, IRouter } from "dobject-routing";

export const routes: IRouter = {
    routes: [
        {
            method: ERequestType.GET,
            handlers: [
                (req, res) => {
                    res.send("Hello");    
                }
            ]
        }
    ]
};
export default routes;

Finally, import and use the package as an example

import express from 'express';
import Routing from "dobject-routing";
import routes from './routes';

const app: express.Application = express();
const PORT: number = 8080;

app.use('/', Routing(routes));

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

Author

šŸ‘¤ Carter J. Wilde

šŸ“ License

Copyright Ā© 2021 Carter J. Wilde. This project is GNU GPL v3 licensed.

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago