I'm working as a beginner with Deno and the Opine framework. The first page is for login, but I can't read values of the form fields.
Form :
<form action="/signin" method="POST" style="margin-top:30px;">
<input type="text" name="user" placeholder="Username" required="required" class="input-txt" value=""/>
<p> </p>
<input type="password" name="password" placeholder="Password" required="required" class="input-txt" />
<div class="login-footer">
<button type="submit" class="btn btn--right">Sign in </button>
</div>
</form>
Router in controller - my main problem is HERE. Can't understand how to read values of fields :
index.ts :
import { Router } from 'https://deno.land/x/opine/mod.ts';
const router = new Router();
router.post("/signin", async ( req, res ) =>
{
console.log( "here... ???" );
})
export default router;
In server.ts:
import signin from "./controller/index.ts";
...
app.use( "/", signin );
I found many samples with OAK framework. In the post they use like that :
(ctx) => {
const form = ctx.request.body ...
But the Opine framework seems to work in different way.