diff --git a/js-skeleton/skeleton-building-blocks/index.md b/js-skeleton/skeleton-building-blocks/index.md index 764f044..0a8710b 100644 --- a/js-skeleton/skeleton-building-blocks/index.md +++ b/js-skeleton/skeleton-building-blocks/index.md @@ -101,20 +101,20 @@ phases of the application. const TodosList = Skeleton.List({ model: TodoModel, element: 'todo-list', - template: {templateId: 'todo-template'} + templateId: 'todo-template' }); ``` * 'model': The model that builds the list. * 'element': The html element that will contain the list models. -* 'template': A string, or an object with templateId field to specify the template. +* 'template' or 'templateId': A string representing the template, or a templateId which specifies the id of the template element in the html --- Now, let's write our server code. This is not the main issue in this tutorial so let's go over it really briefly: ```js -var express = require('express'); -var path = require('path'); -var app = express(); +const express = require('express'); +const path = require('path'); +const app = express(); app.use(express.static(path.join(__dirname, 'public'))); @@ -127,7 +127,7 @@ function main(req,res) { res.sendFile(__dirname + '/public/index.html'); } -app.listen(8000, function(err) { +app.listen(8000, (err) => { if(err) { return 'An error has occured: ' + err.message; } @@ -138,4 +138,4 @@ app.listen(8000, function(err) { Basically, we set a simple nodejs express server, and we serve the same file to all our paths ('/', '/all', '/active', '/completed') since we are building a spa. You will need to install expressjs: *npm install express --save*, -and the server will run on *localhost:8000*. \ No newline at end of file +and the server will run on *localhost:8000*. diff --git a/js-skeleton/skeleton-starter/index.md b/js-skeleton/skeleton-starter/index.md index ad74a0e..224e427 100644 --- a/js-skeleton/skeleton-starter/index.md +++ b/js-skeleton/skeleton-starter/index.md @@ -6,8 +6,8 @@ retrieve the filter and applying the router on it. Here is the code snippet: ```js -let todos = Skeleton.storage.fetch('todos'); +let todos = Skeleton.storage.fetch('todos') || []; TodosList.pushAll(todos); // push all stored todos let filter = Skeleton.storage.fetch('filter') || 'all'; router.visit(`/${filter}`); // go to last saved path -``` \ No newline at end of file +```