Hi, guys, long time to not update my blog in 博客园,Now, I'm studying in Denmark, and worked part-time in a start-up. Everything is fine now. For everyday I touch new things in my work and study, I want record them in my blogs, because they are so easy to be forgotten. Meanwhile, I think it is very hard to insist if I cost several hours to do this thing, I don't want to give up after several days:) So, I decide just to take about half a hour a day to do this meaningful thing. It's cooool.

Ok, I will start and most piece of words would be in English in order to help myself practice my English.

deployment, CI/CD

Many start-ups put their code repositories in github or gitlab, and when them push a new version to gitlab, they need a quick and robust tool to deploy the code to production environment (like amazon cloud). So this whole process is called Continuous integration and Continuous deployment. Jenkins is a good tool to do this job and have both windows and linux version.

use jest to mock a file object or file-upload process

In my company, I need using jest to test the server (using apollo server and graphql), but it's really hard to mock the file stuff. I search in goole, tried a lot of solution, and still can't find one that works.The thing is that the server side doesn't consider it is a file.. So I ask my question in StackOverflow https://stackoverflow.com/questions/57506231/how-to-mock-file-upload-or-file-object-in-jest.

user registration and send email

When user want register, our system should send user's email address an email which contains a link for user to activate his account in our system. And we decide to put the a encoded string which contains the information of his email in the link. We do like this, because we don't want to create a user in our database before the user activates his account.

dataSource in apollo-server

the file in datasource folder should only communicate with DB, and in particular, components.js should only communicate the collection Components in MongoDb. So we should keep the other logic in resolver or in some services.

debug in Jest

when use Jest to test , debug is an annoying thing. The message in most situation doesn't show the real problem. When it shows a 400 error from server, it means that there is some wrong in your graphql structure.

apollo server engine

apollo server engine is a good online tool that help the developer statistics the visiting data and errors. With this tool, developer can easily know the running status of the website.

Altair

Altair is a good tool send request with file to apollo-server.