Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Commit

Permalink
Added templates and templating engine to documentation website.
Browse files Browse the repository at this point in the history
  • Loading branch information
yummyweb committed Nov 9, 2020
1 parent a0b3d7f commit c428675
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,10 @@ neuronjs.POST('/post', (req, res) => {
})

const server = neuronjs.listen(5000, () => console.log(`Server running on ${5000}`))
```
```

#### Templates and Template Engine

Neuron uses a new template engine called `squirrelly`, which is not very well known, so for more information on `squirrelly` and how it works, check out [the squirrelly docs](https://squirrelly.js.org/). To load a new view or template, instead of using `res.render()` as you would in Express, we can use `neuronjs.view()` which takes view/template name as the first arguement. It takes context as the second arguement and a function as third. Before talking about context, the third function arguement basically, takes parameters in that function. The parameters are: `err`, `res` and `req`. `res` and `req` are response and request respectively, but error is the returned error which you get back with which you can check for error and do something based on that.

!> Make sure that the first arguement for **neuronjs.view()** is within the directory specified in `configureView()`

0 comments on commit c428675

Please sign in to comment.