This is an API developed during the course "Rest API NodeJs using TDD, Clean Architecture and Typescript" by Rodrigo Manguinho, focusing on the development of a decoupled API using the best practices of TDD, Clean Architecture, DDD and Solid. Outside the course, I used some references like Clean Code TypeScript for better enjoyment and personal development.
- [POST] - Create user:
{{host}}/api/signup - [POST] - Sign in user:
{{host}}/api/signin
- [POST] - Create Survey
{{host}}/api/survey - [GET] - Search All Surveys
{{host}}/api/surveys
- [PUT] - Save Survey Result
{{host}}/api/surveys/{{survey-id}}/results - [GET] - Load Survey Result
{{host}}/api/surveys/{{survey-id}}/results
URI: {{host}}/graphql
// Create User
mutation {
signUp(name: "Jonh Foo Bar", email: "jonhfoobar@email.com", password: "12345", passwordConfirmation: "12345") {
accessToken
name
}
}// Sign in user
query {
signIn(email: "jonhfoobar@email.com", password: "12345"){
accessToken
}
}// Create Survey
mutation {
survey(question: "test?", answers: [{ image: "foo", answer: "foo" }])
}// Search All Surveys
query {
surveys {
id
question
answers {
image
answer
}
createdAt
}
}// Answer Survey
mutation {
saveSurveyResult(surveyId: "6328d447c15003f6e6865391", answer: "foo") {
surveyId
question
createdAt
answers {
image
answer
isCurrentAccountAnswer
percent
count
}
}
}// Load Survey Result
query{
surveyResult(surveyId: "6328d447c15003f6e6865391") {
surveyId
question
createdAt
answers {
image
answer
isCurrentAccountAnswer
percent
count
}
}
}Swagger: {{host}}/api-docs
- Node.js + Typescript
- Express
- Nodemon
- Bcrypt
- JWT(Json Web Token)
- MongoDB
- Design Pattern (Composite, Adapter, Builder and Factory)
- Clean Architecture
- SOLID
- DDD
- TDD
- GraphQL
- npm run start:dev
cp example.env .env
npm installtsc -wnpm run start:dev // using docker
or
npm run build
npm run start // using nodeNotice: This command is configured with debug in vsCode
npm run stop:dev //stop docker- REST:
{{host}}:3003 - Debug:
{{host}}:9222
# Running test without coverage
npm run test
# Unit test
npm run test:unit
# Integration test
npm run test:Integration
# Running all test with coverage
npm run test:ci
# Running all test and show errors
npm run test:verbose