heroku login が異常に長くなったので .netrcを消したら戻った!
------------------------------------------------------------※helo.ejs
<body>
<h1><%= title %></h1>
<%= msg %>
<form method=
"post"
action=
"/helo"
> // /post is mistype of tuyano
<input type=
"text"
name=
"input1"
value=
"<%= input %>"
>
<input type=
"submit"
>
</form>
</body>
※helo.js
var
express = require(
'express'
);
var
router = express.Router();
/* GET helo page. */
router.get(
'/'
,
function
(req, res, next) {
var
p1 = req.query[
"p1"
];
var
p2 = req.query.p2;
var
msg = p1 == undefined ?
""
: p1 +
","
+ p2;
res.render(
'helo'
,
{
title:
'HELO Page'
,
msg: msg,
input:
''
}
);
});
/* POST helo page. */
router.post(
'/'
,
function
(req, res, next) {
var
str = req.body[
'input1'
];
res.render(
'helo'
,
{
title:
'HELO Page'
,
msg:
"you typed: "
+ str,
input: str
}
);
});
module.exports = router; // this line is necessary!!
https://symfoware.blog.fc2.com/blog-entry-2114.html for pg@7(promiseOK?)
pg@6の例題も多いが、pg-promiseに移行しつつある
------------------------------------------------------------------------
https://qiita.com/Suibari_cha/items/48da8519d6f363925b6a これで複雑な構成のHTML+CSSもnode.jsに乗っけれる google driveに成功例をおいた engines
:nodeにVが必須(package.json), listen(....||3000,....)はlibro!