58 lines
1.3 KiB
JavaScript
58 lines
1.3 KiB
JavaScript
|
import { Router } from "express";
|
||
|
const router = Router();
|
||
|
|
||
|
router.get('/login', (req, res, next) => {
|
||
|
res.ctx.mainPage = 'form'
|
||
|
res.ctx.mainCtx = {
|
||
|
title: "Log in",
|
||
|
message: "hi",
|
||
|
action: "/api/you/login",
|
||
|
inputs: [
|
||
|
{
|
||
|
"key": "Username",
|
||
|
"type": "text",
|
||
|
"name": "user",
|
||
|
"default": ""
|
||
|
},
|
||
|
{
|
||
|
"key": "Password",
|
||
|
"type": "password",
|
||
|
"name": "pass",
|
||
|
"default": ""
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
next();
|
||
|
})
|
||
|
|
||
|
router.get('/new', (req, res, next) => {
|
||
|
res.ctx.mainPage = 'form'
|
||
|
res.ctx.mainCtx = {
|
||
|
title: "Register",
|
||
|
message: "hi",
|
||
|
action: "/api/you/new",
|
||
|
inputs: [
|
||
|
{
|
||
|
"key": "Username",
|
||
|
"type": "text",
|
||
|
"name": "user",
|
||
|
"default": ""
|
||
|
},
|
||
|
{
|
||
|
"key": "Password",
|
||
|
"type": "password",
|
||
|
"name": "pass",
|
||
|
"default": ""
|
||
|
},
|
||
|
{
|
||
|
"key": "Password (again)",
|
||
|
"type": "password",
|
||
|
"name": "pass2",
|
||
|
"default": ""
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
next();
|
||
|
})
|
||
|
|
||
|
export default router;
|