/todos-express-password-flash

Todo app using Express, Passport, and SQLite for sign in with username and password.

Primary LanguageCSSThe UnlicenseUnlicense

todos-express-password-flash

This app illustrates how to use Passport with Express to sign users in with a username and password. Use this example as a starting point for your own web applications.

Quick Start

To run this app, clone the repository and install dependencies:

$ git clone https://github.com/passport/todos-express-password-flash.git
$ cd todos-express-password-flash
$ npm install

Then start the server.

$ npm start

Navigate to http://localhost:3000.

Tutorial

Follow along with the step-by-step Username & Password Tutorial to learn how this app was built.

Overview

This example illustrates how to use Passport and the passport-local strategy within an Express application to sign users in with a username and password.

This app implements the features of a typical TodoMVC app, and adds sign in functionality. This app is a traditional web application, in which all application logic and data persistence is handled on the server.

User interaction is performed via HTML pages and forms, which are rendered via EJS templates and styled with vanilla CSS. Data is stored in and queried from a SQLite database.

After users sign in, a login session is established and maintained between the server and the browser with a cookie. As authenticated users interact with the app, creating and editing todo items, the login state is restored by authenticating the session.

When sign in fails, an informative message is displayed to users using the failureFlash option, in conjuction with connect-flash middleware.

License

The Unlicense

Credit

Created by Jared Hanson