Comments (5)
Currently, we have 463 lines of code in our routes.js and we don't finish to add routes inside yet!
from bhima.
It should be noted that we will be removing some routes. For example, the following:
app.get('/available_cost_center/', financeServices.availableCostCenters);
app.get('/available_profit_center/', financeServices.availableProfitCenters);
app.get('/cost/:id_project/:cc_id', financeServices.costCenterCost);
app.get('/profit/:id_project/:pc_id', financeServices.profitCenterCost);
app.get('/costCenterAccount/:id_enterprise/:cost_center_id', financeServices.costCenterAccount);
app.get('/profitCenterAccount/:id_enterprise/:profit_center_id', financeServices.profitCenterAccount);
app.get('/removeFromCostCenter/:tab', financeServices.removeFromCostCenter);
app.get('/removeFromProfitCenter/:tab', financeServices.removeFromProfitCenter);
app.get('/auxiliairyCenterAccount/:id_enterprise/:auxiliairy_center_id', financeServices.auxCenterAccount);
However, I agree that we will have too many routes at the current rate.
from bhima.
@DedrickEnc, specifically addressing the routes question (not BLL/DAL layers).
We could break up the server architecture along self-contained modules. ExpressJS allows each module to configure a router which can then be exported and plugged into a main application router. It looks like this:
// inside routes.js
var cashboxes = require('./controllers/cashboxes');
/**
* This binds the /cashboxes URL to the methods defined inside
* the cashboxes controller. All matching sub-routes will be handled by
* that controller.
*/
app.use('/cashboxes', cashboxes);
/**
* Inside the file server/controllers/cashboxes.js
*/
var express = require('express');
var router = express.Router();
router.get('/', function list(req, res, next) { /* .. code .. */});
router.get('/:uuid', function detail(req, res, next) { /* .. code .. */});
router.post('/', function create(req, res, next) { /* .. code .. */});
// etc ...
// expose the router to the main server
module.exports = router;
For documentation on this method, see ExpressJS Routing.
In my opinion, the advantages are:
- Encourages modularity.
- Cleaner routes.js file
- Potential for module-level error handling
Disadvantages:
- Cannot view the entire app functionality in one file (as you an now with routes.js). We will need to include very explicit comments in routes.js to describe what each controller does.
- Where do shared modules (like journal.js) go?
- Full route definition not available in each module -- again, this can be fixed with comments. But we must be explicit that
.get('/')
in the cashboxes controller will actually match a GET request to the route '/cashboxes'.
from bhima.
We must take a decision by tomorrow, it must not be a pending design decision
from bhima.
No opportunity to use it for now, I close it!
from bhima.
Related Issues (20)
- Cannot search by user on registries in BHIMA HOT 1
- Do not accept negative values for payroll indices HOT 3
- Removing employees from payroll configuration crashes the multiple payroll indice HOT 1
- Users report 5% pay code increase does not work HOT 2
- Provide better error messages for payroll errors
- Ignore employees who worked 0 days in payroll calculation
- Add a confirmation modal before employees are put on the payment waiting list
- Unable to display the item in stock and batch in stock register due to the error ER_DIVISION_BY_ZERO HOT 2
- Journal entry error when customer invoice has a value of zero HOT 5
- Expiry date not showing on In Stock Batch Report HOT 1
- Suggestion to modify the text sale responsible on the invoice HOT 1
- Exclude "action" columns from the column selection modal
- OHADA income statement report crashes the application
- Patient billing, change select to selection with filter
- Error in Report OHADA Balance Sheet HOT 1
- Problem regarding the increase in basic indices based on percentages HOT 3
- Fix getAMC integration:stock test
- Fix unit price input field to allow zero
- Problem of deductions from salaries above the net salary (bonus) HOT 1
- Adding lines to a transaction in the transaction edit modal breaks the transaction
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bhima.