Saving an JWT token in local storage is unsave! If you're not using sessions be sure to save it in a cookie with flags like httpOnly
, expires
or maxAge
, sameSite
and secure
.
Read more here (for example).
This project is for the module "PBO" @HTW-Dresden. The goal is, to give the people an example, how the interaction between a self developed backend (node.js) and frontend (vue.js) could work. We implemented a little register and login application.
First of all, you need the following:
- PostgreSQL (10.x)
- node.js (min 10.x)
- Vue-Cli (
npm install -g @vue/cli
) - Knex.js, global installation (
npm install knex -g
)
After cloning the repository you need to run the node module installer (be sure to be in the directory).
npm install
Create a new Database (using PostgreSQL commandline)
create database [databasename];
- Make a copy from
knexfile.js.edit
and name itknexfile.js
- Open the file and update your database/username/password from postgreSQL
Now we create the table
knex migrate:latest
Tip: you can undo/delete the migration with knex migrate:rollback
You are good to go now
// Compiles and hot-reloads for development
> npm run serve
// Start Server
> npm run start
// Compiles and minifies for production
> npm run build
// Lints and fixes files
> npm run lint