Skip to content
Snippets Groups Projects
Commit f7b5f80b authored by Lehtinen Teemu's avatar Lehtinen Teemu
Browse files

Use let when appropriate

parent f3320812
Branches main
No related tags found
No related merge requests found
# acos-webdev-iwdap # acos-webdev-iwdap
Content package for Acos-servers that adds web development exercises Content package for Acos-servers that adds web development exercises
designed for *Introduction to Web Development and Programming*. where student experiments with web using a browser inspector tool.
## Installation ## Installation
For the time being, this package requires that `acos-webdev` package has been installed manually. This package requires that `acos-webdev` package has been installed
as a dependency.
## Testing ## Testing
Tests are written with WebDriverIO, refer to the `acos-server` documentation on testing. Tests are written with WebDriverIO, refer to the `acos-server`
documentation on testing.
/* global module, require, __dirname, console */ /* global module, require, __dirname, console */
/* jshint globalstrict: true */ /* jshint globalstrict: true */
'use strict'; 'use strict';
var nj = require('nunjucks'); let nj = require('nunjucks');
var fs = require('fs'); let fs = require('fs');
var AcosMod = function () {}; let AcosMod = function () {};
var baseDir = __dirname; let baseDir = __dirname;
var content = JSON.parse(fs.readFileSync(baseDir + '/content.json', 'utf8')); let content = JSON.parse(fs.readFileSync(baseDir + '/content.json', 'utf8'));
AcosMod.initialize = function (req, params, handlers, cb) { AcosMod.initialize = function (req, params, handlers, cb) {
var templateDir = baseDir + '/templates/'; let templateDir = baseDir + '/templates/';
nj.configure(templateDir, { autoescape: false }); nj.configure(templateDir, { autoescape: false });
var config = content[params.name];
let config = content[params.name];
config.abFlag = params.abFlag; config.abFlag = params.abFlag;
if (config.template) { if (config.template) {
config.html = nj.render(config.template, config); config.html = nj.render(config.template, config);
} }
var templateParam = {
let templateParam = {
id: 'acos-webdev-inspector-' + params.name, id: 'acos-webdev-inspector-' + params.name,
config: JSON.stringify(config), config: JSON.stringify(config),
acceptTest: config.acceptTest, acceptTest: config.acceptTest,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment