nodeash
v3.0.9
Published
nodeash-sql is node js sql server package
Downloads
27
Readme
Nodeash Server
Nodeash is a lightweight Node.js package for running servers efficiently.
Installation
You can install Nodeash via npm:
npm install nodeash
Usage
import {NodeashRoutes, ServerClient} from 'nodeash';
const register = (req, res) => {
try {
res.send('Register API called');
} catch (error) {
}
}
const login = (req, res) => {
try {
res.send('login API called');
} catch (error) {
}
}
// Example usage:
const userControllers = [
{
method: 'post',
endpoint: '/register',
handler:register
middleware: [middleware_1 , middleware_2]
},
{
method: 'post',
endpoint: '/login',
handler:login
middleware: [middleware_1 , middleware_2]
},
// Add more controllers as needed
];
const userRoutes = new NodeashRoutes();
userRoutes.initializeRoutes('/user', userControllers);
// Define a route for the controller API path
const controllers = [userRoutes]
const server = new ServerClient({port : 3007 , baseUrl : "/api", controllers});
server.startServer();