123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- var chalk = {};
- const express = require('express');
- module.exports = function() {
- return {
- name: '@mws/carmen-castillo-landing-page',
- type: 'website',
- auto_load: true,
- initialize: function(system) {
- this.system = system;
- chalk = this.system.chalk;
- },
- install: function(){
- this.system.carmenLandingPage = this;
- if(this.system.carmenLandingPage == undefined)
- this.system.log(this.system.chalk.red('Error: mws-carmen-castillo-landing-page module not found on system!'));
- this.server = this.system.module_loader.instantiate_module(this.system, '@mws/server');
- if(this.server == undefined)
- this.system.log(this.system.chalk.red('Error: Could not install mws-server for mws-carmen-castillo-landing-page module.'));
- else {
- this.system.modules.push(this.server);
- this.server.port = 3000;
- this.server.install();
- this.system.log(` ${this.system.logSymbols.tick} Instantiated ${chalk.bold(this.server.name)} ${chalk.gray('v' + this.server.version)} from ${chalk.green('\'' + this.server.packagePath + '\'')}`);
- }
- },
- setup: function(){
- let viewPath = __dirname + '/views';
- //if(this.system.cpanel.server.viewPaths == undefined) this.system.cpanel.server.viewPaths = [];
- if(this.server == undefined){
- this.system.log(chalk.red('Error: Could not find server!'));
- } else if(this.server.app == undefined){
- this.system.log(chalk.red('Error: Could not find cpanel server app!'));
- }
- this.server.viewPaths.push(viewPath);
- this.server.app.use("/", express.static(__dirname + "/public"));
- this.server.app.get('/', (req, res) => {
- //res.send('Hello World!')
- res.render('start-page', {system: this.system, title: 'Carmen Castillo Imóveis'});
- })
- },
- start: function(){},
- execute: function(){}
- };
- }
|