This is the second assignment of fullstack army bootcamp. Here i will try to build rest api, using express. Here is the detailed research & documentation notion links docs
- Express
- MySQL
- Typeorm
- Joi
- Jest & supertest
first please ensure to checkout assignment_2 branch
git clone https://github.com/nahidnstu12/express-playground-fsa
for install dependencies, run
yarn
copy env.local.example to env.local and set your environment varianbles
copy env.test.example to env.test and set your environment varianbles
create your database for dev & test
then you ready to run your project dev mode, run
yarn dev
and when you want to run tests, run
yarn test
if you want to single file test, run
yarn run test auth.test.js --watchAll=false
notFound messsage
{
"errors": {
"message": "User not found"
},
}
badRequest message
{
"errors": {
"message": "User already exists"
},
}
authenticaionError message
{
"errors": {
"message": "Authentication Failed"
},
}
authorizationError message
{
"errors": {
"message": "You do not have permission to perform this action."
},
}
serverError message
{
"errors": {
"message": "Internal Server Error."
},
}
success message
{
"code": 200,
"message": "Successfully created",
"data": {}
}
For limitations of time, i will listing points what i refactor later.
- route (some route optimized or removed) (fixed)
- User approved / blocked
- Menu published / unpublished
- Model (enum value convert to number) (fixed)
- Require optional authentication middleware (fixed)
- Implement pagination (done)
- Implement Logging for error tracing
- Implement Seeding (done)
- transactions
- Params validation
- Query Params validation
single test file run
yarn run test auth.test.js --watchAll=false
Mazharul Islam nahid.dev19@gmail.com