Task Detail
-
Moved the project over
10/26/2024 14:47:03 -
Activity on Mon Jun 04 2018 11:58:26 GMT+0000 (UTC) 1. Create a plugin to serve common router for now. 2. I will need to figure out how to DRY for the logger and the common modules for all plugins. 3. Remember, register plugins in server.js is a little different then add routes in each plugin. 3a. Register plugins in server, each plugin is exported by itself, so fastify.register(plugins) take in one at the time. 3b. Add route in plugin, each file in route folder might have more than one routes, so require(routeDirs[i]) taking in array of routes. Therefore I have to fastify.route(require(routeDirs[i])[i]) to add one route for each loop. 'use strict' const log=require('../../lib/logger.js')(); const fastify=require('fastify')({logger:log}); const path=require('path'); const dir = require('node-dir'); async function pluginOne(fastify, option){ const routeDirs=await dir.promiseFiles(path.join(__dirname, '../..', 'routes')); let routes=[]; for(let i=0; i<routeDirs.length; i++){ log.trace('plugin-one register route at %s', routeDirs[i]); routes=routes.concat(require(routeDirs[i])); log.trace('routes for plugin-one', routes[i]); fastify.route(routes[i]); } } module.exports=pluginOne
10/26/2024 14:13:31 -
Activity on Mon Jun 04 2018 18:26:06 GMT+0000 (UTC) To use auto refresh my pages using browser-refresh, remember to "npm install --save browser-refresh-taglib" and then add "<browser-refresh enabled="true"/>" after <lasso-body/> in template/index.marko
10/26/2024 14:12:47 -
Activity on Mon Jun 04 2018 13:47:02 GMT+0000 (UTC) 1. I often get errors when I apply the template into any view, and there are few reason for the errors: 2. The most import thing: the browser.json file can't be emptied especially the browser.js in template/browser.json. 3. Alway have at least the below in your browser.json: { "dependencies":[ "./lib.js", "./style.css" ] }
10/26/2024 14:12:37