Skip to content
This repository was archived by the owner on Apr 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions js-skeleton/skeleton-building-blocks/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')));

Expand All @@ -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;
}
Expand All @@ -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*.
and the server will run on *localhost:8000*.
4 changes: 2 additions & 2 deletions js-skeleton/skeleton-starter/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
```