This Express API template already have the following features set up:
- Basic authentication: registration, login and logout
- Forgot password feature
- Email verification: by default, this feature is set to false (i.e. optional). You can make it compulsory by setting
MUST_VERIFY_EMAIL=true
in the .env file - Manage basic profile information
- Manage profile image
- Change password feature
- Clone the application and run
npm install
- Create a .env file by running
cp .env.example .env
and provide necessary environment variables. - Run
npm run db-migrate
to create database migrations - Run
npm run dev
to start dev server - Launch Postman or Insomnia and run
- Test if everything is up and running on Postman or Insomnia by sending a
GET
request tolocalhost:{APP_PORT}/api/v1/status
. A200 response code
is an indication that everything is up and running.
The application supports sending of mails using SMTP or Sendgrid API method. You can use either of the options. To use SMTP, set MAIL_DEFAULT_METHOD=smtp
and provide the values for the following depending on the mailing service you are using;
MAIL_DEFAULT_METHOD=smtp
[email protected]
MAIL_FROM_NAME="Node Test App"
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=
MAIL_PASSWORD=
Note that, by default you can also test the mailing feature using Mailtrap by just providing your Mailtrap username and password as seen on your Mailtrap Dashboard. Note that this is only for testing purpose while developing.
To make use of the second mailing option, which is the Sendgrid API method, set MAIL_DEFAULT_METHOD=api
and provide the value for SENDGRID_API_KEY=
. This is the Sendgrid API KEY you created on your Sendgrid Dashboard. You can visit their website to know more about this.
The TOKEN_SECRET_KEY=
is used by the jsonwebtoken npm package. Please, don't leave this option blank. TOKEN_LIFETIME=
can also be set to any value of your choice, by default it is set to 365 days which is a year. You can visit their page on npm to know more.
- NodeJs / Express
- MySQL Database with Sequelize as ORM