This repo is just for testing how an API server would look like using Deno, Oak, DenoDB, DJWT tokens for auth, and BCrypt for hashing.
- It allows you to spin-up a very basic auth system using deno
- It comes with Sigin/Signup methods
- It hashes the password before storing into the database
- It uses hashing for checking if the password matches on the login part
By default, it uses
SQLite, but you
can setup your own connector by modifying this file located at ./confid/db.ts
The documentation is here
The script to run the deno server is localed at ./run.sh
$ sh run.sh
body:
{
"username": "DESIRED_USERNAME",
"password": "DESIRED_PASSWORD"
}
body:
{
"username": "DESIRED_USERNAME",
"password": "DESIRED_PASSWORD"
}
This will ensure that you can access certain routes by putting in the req.body.jwt
your JWT token
Try to access this rute wthout a JWT on the body and see what happens, and then try again but now adding a valid JWT on the body like so:
body:
{
"jwt": "YOUR_JWT_TOKEN"
}
- On the file
./routes.ts
you will find all the routes defined for this prject - If you want to add a new route just add it like:
router.get("/whatever/you/want", controller_name)
- If you want it protected, just add the middleware in between like:
router.get("/whatever/you/want", validateJWT, controller_name)
For any bug reports or feature requests, please create an issue on GitHub.