mirror of
https://github.com/cupcakearmy/cometa.git
synced 2025-03-12 06:17:29 +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()
|
||||
|
||||
app.set('views', './views')
|
||||
app.set('view engine', 'blitz')
|
||||
app.engine('blitz', require('./src/blitz')._express)
|
||||
app.engine('blitz', require('cometa')._express)
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.render('new', {
|
||||
myVar: 'whuup whuup',
|
||||
res.render('index', {
|
||||
title: 'Cometa!',
|
||||
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