Fastfeet is a delivery service application.
As part of this challenge, only an authenticated admin* user can manage recipients.
- The admin was added as seed data for development and should not be used as production data!
This app features all the latest tools and practices in backend development!
- Express
- Sucrase + Nodemon
- ESLint + Prettier + EditorConfig
- Sequelize - using PostgreSQL, but MySQL could also have been used
- Docker for Windows
- jwt for authentication
- Yup for schema (input data) validation
Bellow are the functionalities that were implemented for this application.
Admin user can authenticate using e-mail and password.
Admin user was added as seed data to the application through sequelize seeds. That way mock data can be added to the database automatically.
In order to create a seed, run the following command in your terminal:
yarn sequelize seed:generate --name admin-user
The create filed will be in the folder src/database/seeds
. The code bellow was added to create an admin user:
const bcrypt = require('bcryptjs');
module.exports = {
up: queryInterface => {
return queryInterface.bulkInsert(
'users',
[
{
name: 'FastFeet Delivery Services',
email: 'admin@fastfeet.com',
password_hash: bcrypt.hashSync('123456', 8),
admin: true,
created_at: new Date(),
updated_at: new Date(),
},
],
{}
);
},
down: () => {},
};
Executed:
yarn sequelize db:seed:all
Recipients must be managed in the application, and they need to have name and email as well as: street, street number, complement, state, city and postal code.
A recipients
table was added to the database to hold data about the recipients.
- Recipients can only be added to the database by authenticated admins.
- Recipients can't authenticate.
- Clone this repo using
git clone https://github.com/yagosansz/rockseat-bootcamp2020-challenge02.git
- Move yourself to the appropriate directory:
cd rockseat-bootcamp2020-challenge02
- Run
yarn
to install dependencies
- Run
yarn sequelize db:migrate
to create tables - Run
yarn sequelize db:seed:all
to add seed data to the database - Run
yarn dev
to start the development server - Test routes by either using Insomnia or Postman
Made with ❤️ by Yago!