updated dependecies, added context, axios config

This commit is contained in:
Ben Elferink
2021-03-13 17:46:51 +02:00
parent a895cc0647
commit bc37d68394
19 changed files with 39144 additions and 509 deletions

View File

@@ -0,0 +1,24 @@
import express from 'express';
import { registerAccount, loginAccount, getAccount } from '../controllers/authControllers.js';
// initialize router
const router = express.Router();
// example: empty middleware
const middleware = (request, response, next) => next();
/*
request methods ---> https://www.tutorialspoint.com/http/http_methods.htm
1st param = extended url path
2nd param = middlewares (optional)
3rd param = request & response function (controller)
*/
// POST at route: http://localhost:8080/auth/register
router.post('/register', middleware, registerAccount);
// POST at path: http://localhost:8080/auth/login
router.post('/login', middleware, loginAccount);
// GET at path: http://localhost:8080/auth/account
router.get('/account', middleware, getAccount);
export default router;