This is a 100% basic boilerplate to get an authentication server running.
Feautures
- json webtoken authentication
- proper password hashing using bcrypt
- E-Mail Confirmation (basic mail template thanks to beefree.io)
- Create, Read, Update and Delete users
- proper userUUID's using uuid
git clone https://github.com/faxemaxe/basic-node-auth.git
npm install
var config = {
//secret which is used to hash json-web-token
'secret': 'supersecret-json-web',
//mongoDB Connection
'database': 'mongodb://localhost/basic-node-auth',
'mailConfig': {
//SMTP Host
host: 'host.de',
//SSL Port
port: 465,
//use SSL (recommended)
secure: true,
//mail credentials
auth: {
user: '[email protected]',
pass: 'supersecure'
}
}
};
module.exports = config;
node server
I prefer using nodemon
as a wrapper for standard node server, it watches your files and restarts the server automatically. It is included as a devDependency in the package.json but may require a global installation.
Too often I just needed a small user-crud, maybe featuring a token-based authentication to get a project up and running or just use it as base for something else. There you go, just clone, install, config and run...
use this command to test if the server is up and running properly
register a user
requires:
username
email
password
login a user
requires:
username
ORemail
password
update user data NOT password, to update password see /api/user/password
requires:
- token send as (choose one):
x-access-token
in headerAuthorization
in headertoken
in body
- whatever info you want to change
requires:
- token send as (choose one):
x-access-token
in headerAuthorization
in headertoken
in body
oldPassword
the old passwordnewPassword
the new password
requires:
- token send as (choose one):
x-access-token
in headerAuthorization
in headertoken
in body
password
user password
Describe and show how to run the tests with code examples.
Let people know how they can dive into the project, include important links to things like issue trackers, irc, twitter accounts if applicable.
A short snippet describing the license (MIT, Apache, etc.)