This is a quick-start application that demonstrates basic authentication using Passport and Sequelize. It is built with:
I wrote a blog post Authentication Quickstart with Express, Passport and Sequelize about this quick-start.
As it is a Node application, you will need Node.js installed.
The app uses a SQL database via Sequelize ORM. It was tested with PostgreSQL, but should work with other supported databases as well.
Clone the repository and simply run npm install
from the root folder.
In order to run the application, a database connection string has to be configured. The connection string is stored in app/sequelize.js
.
When Sequelize is configured, you can run the setup script that creates the users
table and also adds one default user (username: user
, password: user
). From the root directory run:
node setup.js
If you want to run the tests, it is necessary to configure Nightwatch.js using the nightwatch.json
file. Namely it is required to provide server path to selenium. For more information see the documentation.
From the root folder of the project, you can run the application with:
node app.js
You can then access the application on http://localhost:8080
.
Available pages:
- Log in on
http://localhost:8080
- Sign up on
http://localhost:8080/signup
- Dashboard [requires to be logged in] on
http://localhost:8080/dashboard
- Log out on
http://localhost:8080/logout
A basic set of Nightwatch end-to-end tests is provided. To run the tests, first make sure that the application is running and then start the test suite by typing nightwatch
in the root folder. Note that you have to configure Nightwatch.js first.
Author: Petr Stříbný
License: The MIT License (MIT)