Open taki-tiler-server[bot] opened 4 years ago
next
In this step you'll have two main tasks: create a node project with typescript and setup a graphql server. But before you start, there are some core concepts you need to know in order to understand what's going on on your code. Try to do some research on your own about these topics, but feel free to ask your tutor, or even another Taqtiler, for references, tips and/or clarifications:
You can both setup these by yourself as showed in this tutorial or use a cli to make this whole setup for you as shown here (we won't tell anyone 🤫). But remember: using this kind of setup doesn't mean you shouldn't know what's going on on that code.
After the setup, you should be able to access the Graphql docs, either on browser, Graphiql or Graphql Playground (you can choose the one you like) and successfully write some GraphQL queries/mutations. You can use the Hello
query of the setups above to verify your server is working. Keep this query for future testing!
Note: For now on, some steps will have an estimated time to help you organizing your time better. If you do not finish the step in the estimated time don't worry! It's just an average time based on previous onboards. The main purpose of it is to indicate when you should ask for help in case you're stuck.
By the way, remember that if you're struggling with any topic, feel free to ask any Taqtiler ;)
next
feature/setup-graphql
branchIf you don't remember how to open a Pull Request, check out the references in the previous issues. Your PR should have develop
branch as base, to be merged into later.
This pull request will be reviewed by your Taqtile tutor and possibly by some other people. This process is called Code Review (CR). You can ask your tutor who will be revising your code.
Make sure you're marking them on every Pull Request as reviewers. Check here for an example of Code Review. You'll possibly have some changes requested/suggested in order to merge this new branch on develop
.
After opening the pull request, you can continue your work on a new branch.
next
[Spoiler alert]: in the end of this onboard, you'll basically develop a CRUD of an entity called User
. So, in order to store the user data in our app, let's create a real database.
The database we use on most of our projects is PostgresSQL, an open-source relational database.
feature/setup-database
for the next 2 steps.There are a lot of setup so far right? In order to reduce the project setup time, we use Docker containers to create a database to work locally while developing. We'll create 2 databases: one for running server locally and another for (spoiler alert 2) the tests. Yeah, we will write tests. 🤓
First, make sure you have Docker installed on your machine. Just hit Command Space and type Docker
. If not, you can download on their site.
docker-compose.yml
file on your root project folder.docker-compose.yml
file. You can use this example if you want, just replace the values on environment
fields.$ docker-compose up -d
on terminal to mount your containers.Note: Before run docker-compose
commands, make sure that the docker is running on your mac. You can use again Command Space, type Docker
and hit Enter.
Note 2: If you want to stop your containers, you can run $ docker-compose stop
command in your project's root folder.
next
In this step, you'll connect your code with the database and create your first table using only Typescript 😎.
Do we have a library to access our database? Of course we do. For this, we use the TypeORM library. It helps us to make database operations (create tables, access data and so on) in a very simple way.
docker-compose.yml
.start
code. For now, you can connect only with your local database, leaving the test connection for later.Note: don't forget to check if your docker container is running before connecting to the DB, otherwise it will fail.
Now you can ask: "Do they have a tool to manage the data inside the database without code?" Of course we do, young padawan. Actually, we recommend these two apps:
Feel free to choose one of these above, or any other app you want :D
After successfully connecting TypeORM to your database, it's time to see it working by creating your first table. Guess what? It will be called User
(we told you so)
Note 2: too much for one step? Don't get stuck and feel free to ask anything to any Taqtiler 👍
next
Here in Taqtile, before merging our revised (and approved) branches, we rebase it into the one we are attempting to merge. In this case, you'll rebase feature/setup-graphql
to develop
.
Too confusing? Here are some good links you can read about rebase:
Note: after your feature/setup-database
is approved, you'll repeat this process.
next
Click here for your next track
Step 1/6 - Create a git branch
feature/setup-graphql
If you don't remember how to create a branch, check the references in the previous issues.
Note: From here, the issues will contain fewer tutorials and step-by-step guides. However, it doesn't mean you won't be able to ask. You can always ask anything to any Taqtiler. We are here to help 😉