Skip to content

VacantThinker/util_express_js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

how to use ?

dir

express-project/
  server/
    router/
      notice.router.js
      open.router.js
  
    util.express.js  <=== (generator by xxx.js geneUtilExpressJs() )
    app.js (const app = express() )
  
  xxx.js  <=== (node xxx.js)

in xxx.js

const {geneUtilExpressJs} = require('@vacantthinker/util_express_js');
geneUtilExpressJs()

generator util.express.js

node xxx.js

util.express.js

'use strict';

function setupRouterList(app, passdata) {
  const noticeRouter = require('./router/notice.router.js');
  const openRouter = require('./router/open.router.js');
  app.use('/notice', noticeRouter(passdata));
  app.use('/open', openRouter(passdata));
}
module.exports = {
  setupRouterList: setupRouterList
}

in your app.js (express)

require('./util.express').setupRouterList(app, passdata);
app.listen(3000, async () => {
  console.log(`running 3000`);
});

how to install ?

npm install @vacantthinker/util_express_js -D

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published