1234567891011121314151617181920212223242526272829303132 |
- const express = require('express');
- const chalk = require('chalk');
- const expressLayouts = require('express-ejs-layouts')
- module.exports = function() {
- return {
- name: '@mws/server',
- type: 'server',
- auto_load: false,
- port: 5555,
- initialize: function(system) {
- this.system = system;
- },
- install: function(){
- this.app = express();
- this.app.set('view engine', 'ejs');
- this.app.use(expressLayouts);
- this.viewPaths = [];
- },
- setup: function(){
- },
- start: function(){
- this.app.set('views', this.viewPaths);
- this.app.listen(this.port, () => {
- let url = chalk.bold.cyan('http://localhost:' + this.port + '/');
- this.system.log(`${this.name} listening on port ${url}`);
- })
- }
- };
-
- }
|