mirror of
https://github.com/cupcakearmy/cometa.git
synced 2025-03-12 14:27:28 +00:00
Express Example
This commit is contained in:
parent
c439643dc1
commit
7383bf15bb
@ -1,18 +1,19 @@
|
|||||||
import * as express from 'express'
|
const express = require('express')
|
||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
|
|
||||||
app.set('views', './views')
|
app.set('views', './views')
|
||||||
app.set('view engine', 'blitz')
|
app.set('view engine', 'blitz')
|
||||||
app.engine('blitz', require('./src/blitz')._express)
|
app.engine('blitz', require('cometa')._express)
|
||||||
|
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
res.render('new', {
|
res.render('index', {
|
||||||
myVar: 'whuup whuup',
|
title: 'Cometa!',
|
||||||
arr: [{
|
arr: [{
|
||||||
test: true
|
show: true,
|
||||||
|
msg: 'Show meee',
|
||||||
}, {
|
}, {
|
||||||
test: false
|
show: false,
|
||||||
|
msg: 'I\'m hidden :(',
|
||||||
}],
|
}],
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
21
examples/express/views/index.html
Normal file
21
examples/express/views/index.html
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<!doctype html>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>{{title}}</h1>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
{{* i in arr}}
|
||||||
|
|
||||||
|
{{? i.show }}
|
||||||
|
<li>{{i.msg}}</li>
|
||||||
|
{{/?}}
|
||||||
|
|
||||||
|
{{/*}}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user