1

We have been asked by an industry association to create an online software platform for their members. Roughly 70% of the functionality will be standard stuff like customers, products, orders, payments, distributors, etc. The other 30% will be very specific to that individual member. Things like distributor compensation schemes, product specials, distributor incentives. And some of this 30% can be quite complicated and very unique (and proprietary) to the individual member.

We feel the best approach is to allow for plugins for the unique 30%, so that each member will have their own plugins on-top of the 70% base. We will, of course, need a published API for the plugins to interact with.

We lack experience in this area, and would like to hear from the community as to the proper architecture for this platform, especially considering all the newer technologies coming out. Buzzwords around the office include docker containers, SOA, etc.

Our stack is linux, node.js, express, jade, and Firebird DBMS.

0

);

//both index.js and things.js should be in same directory app.use('/api/admin', Admin);

app.use('/api/form' , Form);

app.get('/', function(req, res){ res.send("Hello world!"); });

app.get('/', function(req, res){

res.send('From page');

});

app.listen(3000);

(index.js)

var express = require('express'); var router = express.Router(); var bodyParser = require('body-parser');

router.use(bodyParser.json()); router.use(bodyParser.urlencoded({extended:false})); //connent database var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost:27017/Applicationform_db', { useNewUrlParser: true });

var formModel = mongoose.Schema({ username: String, password: String, email: String });

var Formdb = mongoose.model("formdb", formModel);

router.post('/', function(req, res){ res.send('POST route on things.'); });

router.post('/edit', function(req, res){ var FormContent = req.body; var updateForm = ({ username: FormContent.username, password: FormContent.password, email: FormContent.email });

Formdb.update({username: updateForm.username},updateForm, function (err) {
    if (!err) {
        res.send('1')
    }
    else {
        res.send('0')
    }

});
module.exports = router;

});

(form.js)

TypeError: Router.use () ต้องการฟังก์ชั่นมิดเดิลแวร์ แต่มี Object at Function.use (D: \ dbform \ bd-project \ node_modules \ express \ lib \ router \ index.js: 458: 13) ที่ Function (D: \ dbform \ bd-project \ node_modules \ express \ lib \ application.js: 220: 21) ที่ Array.forEach () ที่ Function.use (D: \ dbform \ bd- โครงการ \ node_modules \ express \ lib \ application.js: 217: 7) ที่ Object (D: \ dbform \ bd-project \ index.js: 21: 5) ที่ Module._compile (ภายใน / modules / cjs / loader.js: 776: 30) ที่ Object.Module._extensions..js (ภายใน / โมดูล /cjs/loader.js:787:10) ที่ Module.load (ภายใน / modules / cjs / loader.js: 643: 32) ที่ Function.Module._load (ภายใน / modules / cjs / loader.js: 556: 12 ) ที่ Function.Module.runMain (ภายใน / modules / cjs / loader.js: 839: 10) ที่ภายใน / main / run_main_module.js: 17:

New contributor
พิชญเชษฐ์ เทพวงค์ is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

TypeError: Router.use() requires a middleware function but got a Object at Function.use (D:\dbform\bd-project\node_modules\express\lib\router\index.js:458:13) at Function. (D:\dbform\bd-project\node_modules\express\lib\application.js:220:21) at Array.forEach () at Function.use (D:\dbform\bd-project\node_modules\express\lib\application.js:217:7) at Object. (D:\dbform\bd-project\index.js:21:5) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:643:32) at Function.Module._load (internal/modules/cjs/loader.js:556:12) at Function.Module.runMain (internal/modules/cjs/loader.js:839:10) at internal/main/run_main_module.js:17:11 [nodemon] app crashed - waiting for file changes before starting...

HELP

New contributor
พิชญเชษฐ์ เทพวงค์ is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.