1.1.4 • Published 2 years ago

ags_authrest v1.1.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

ags_authrest


const express = require("express");

const bodyParser = require("body-parser");

const app = express();

app.use(bodyParser.json());

app.use(bodyParser.urlencoded({ extended: true }));

//เรียกใช้งาน

const ags_restauth = require("ags_authrest");

const Auth = new ags_restauth();

//.env

process.env.SECERT_JWT = "ihavealongpassword"; //ใช้secert ที่มีความปลอดภัยสูง

//เปิดใช้ request เพื่อทดสอบ

// process.env.R_USER = "karan"

// process.env.R_PASS = "123456"

//app.use(Auth.RequestToken)

//ตัวอย่าง midleware ที่มีการ protect

app.post("/jwtauth", Auth.Middleware, (req, res, next) => {

return res.send(true);

});

const port = process.env.PORT || 3999;

app.listen(port, () => console.log("Server is listening on port ${port}."));

//สำหรับเรียกใช้ token (async () => { console.log(await Auth.GenToken(process.env.SECERT_JWT, process.env.R_USER)); })();

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago