Last active
December 9, 2021 07:29
-
-
Save kewang/83addb9f73b0d1d5115aab3638d1c269 to your computer and use it in GitHub Desktop.
test2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var router = express.Router(); | |
router.get("/test1/:address/:country", function (req, res, next) { | |
const name = req.query.name; | |
const number = req.query.number; | |
const address = req.params.address; | |
const country = req.params.country; | |
res.render("test1", { | |
user: { | |
name: name, | |
number: number, | |
address: address, | |
country: country | |
}, | |
}); | |
}); | |
router.get("/test2", function (req, res, next) { | |
res.render("test2"); | |
}); | |
router.post("/test2", function (req, res, next) { | |
const name = req.body.name; | |
const number = req.body.number; | |
const introduction = req.body.introduction; | |
res.render("test2", { | |
user: { | |
name: name, | |
number: number, | |
introduction: introduction, | |
} | |
}); | |
}); | |
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doctype html | |
html | |
head | |
link(rel='stylesheet', href='/stylesheets/style.css') | |
body | |
form(method="post") | |
input(type="text" name="name" placeholder="please input name") | |
p | |
input(type="text" name="number" placeholder="please input number") | |
p | |
textarea(name="introduction", cols="30", rows="10" placeholder="please input introduction") | |
p | |
button(type="submit") Submit | |
hr | |
if user | |
if user.name | |
p= user.name | |
if user.number | |
p= user.number | |
if user.introduction | |
p= user.introduction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment