Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wakanapo committed Apr 26, 2022
0 parents commit 4daaf07
Show file tree
Hide file tree
Showing 749 changed files with 126,272 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Build@Mercari Training Program 2022

This is @<your github id>'s build training repository.

Build trainingの前半では個人で課題に取り組んでもらい、Web開発の基礎知識をつけていただきます。
ドキュメントには詳細なやり方は記載しません。自身で検索したり、リファレンスを確認したり、チームメイトと協力して各課題をクリアしましょう。

ドキュメントには以下のような記載があるので、課題を進める際に参考にしてください。

In the first half of Build@Mercari program, you will work on individual tasks to understand the basics of web development. Detailed instructions are not given in each step of the program, and you are encouraged to use official documents and external resources, as well as discussing tasks with your teammates and mentors.

The following icons indicate pointers for

**:book: Reference**

* そのセクションを理解するために参考になるUdemyやサイトのリンクです。課題内容がわからないときにはまずReferenceを確認しましょう。
* Useful links for Udemy courses and external resources. First check those references if you're feeling stuck.

**:beginner: Point**

* そのセクションを理解しているかを確認するための問いです。 次のステップに行く前に、**Point**の問いに答えられるかどうか確認しましょう。
* Basic questions to understand each section. Check if you understand those **Points** before moving on to the next step.

## Tasks

- [ ] **STEP1** Git ([JA](document/step1.ja.md)/[EN](document/step1.en.md))
- [ ] **STEP2** Setup environment ([JA](document/step2.ja.md)
/[EN](document/step2.en.md))
- [ ] **STEP3** Develop API ([JA](document/step3.ja.md)
/[EN](document/step3.en.md))
- [ ] **STEP4** Docker ([JA](document/step4.ja.md)/[EN](document/step4.en.md))
- [ ] **STEP5** (Stretch) Frontend ([JA](document/step5.ja.md)
/[EN](document/step5.en.md))
- [ ] **STEP6** (Stretch) Run on docker-compose ([JA](document/step6.ja.md)
/[EN](document/step6.en.md))
- [ ] **STEP7** (Optional) Expand application ([JA](document/step7.ja.md)
/[EN](document/step7.en.md))
Binary file added data/text_en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/text_ja.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions db/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sqlite3
77 changes: 77 additions & 0 deletions document/step1.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# STEP1: Git

In this step, we will learn how to use Git and Github.

**:book: Reference**
* [Git basics](https://www.atlassian.com/git)
* [GitHub Ultimate: Master Git and GitHub - Beginner to Expert](https://www.udemy.com/course/github-ultimate/)

## Install Git
1. Install git in your environment and run the following command.
```shell
$ git version
```
2. Set your name and email address using git config. Check if your email address shows up.
```shell
$ git config user.email
<your-email-adress>
```

## Fork this **mercari-build-training-2022** repository

* Fork [mercari-build-training-2022](https://github.com/mercari-build/mercari-build-training-2022) (TODO: Update link)
* You will see be able to see `https://github.com/<your github id>/mercari-build-training-2022` if successful.

## Use basic commands in Git

1. **Clone** `https://github.com/<your github id>/mercari-build-training-2022` onto your local using the following command.
```shell
$ cd <your working space>
$ git clone https://github.com/<your github id>/mercari-build-training-2022
```
2. Make a new branch named `first-pull-request` and **checkout** into this branch
```shell
$ cd <your working space>/mercari-build-training-2022
$ git branch first-pull-request
$ git checkout first-pull-request
```
3. Replace `@<your github id>` on README.md with your Github ID.
4. **commit** the changes you made with the following commands.
```shell
$ git status # Check your change
$ git add README.md # Add README.md file to the list of files to commit
$ git commit -m "Update github id" # Brief description about the changes
```
5. **push** changes to Github.
```shell
$ git push origin first-pull-request:first-pull-request
```
6. Open `https://github.com/<your github id>/mercari-build-training-2022` and make a **Pull Request** (PR).
- base branch: `main`
- target branch: `first-pull-request`

## Review a PR and have your PR reviewed
- Once you made a PR, ask a teammate for review.
- If at least one person `approve`s the PR, `merge` into the main branch
- Open your teammates' PRs and check the files changed, and `approve` if you think the changes look good.
---

**:book: Reference**
- [How to do a code review](https://google.github.io/eng-practices/review/reviewer/)


**:beginner: Points**

Check if you understand the following concepts.

- branch
- commit
- add
- pull, push
- Pull Request

---

### Next

[STEP2: Building local environmentSTEP2: Building local environment](document/step2.en.md)
79 changes: 79 additions & 0 deletions document/step1.ja.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# STEP1: Git

このステップではGitとGithubの使い方を学びます。

**:book: Reference**
* [Gitを使ったバージョン管理](https://backlog.com/ja/git-tutorial/intro/01/)
* [Udemy - Git & Github基礎講座](https://www.udemy.com/course/git-github-a/)

## Gitをインストールする
1. Gitをご自身のPCにインストールしてください。以下のコマンドが動けばOKです。
```shell
$ git version
```
2. git configに自分の名前とemailアドレスを設定します。以下のコマンドを実行してあなたのemailアドレスが表示されればOKです。
```shell
$ git config user.email
<your-email-adress>
```

## **mercari-build-training-2022** リポジトリをフォークする

* [mercari-build-training-2022](https://github.com/mercari-build/mercari-build-training-2022)
をあなたのGithubにForkします。 (TODO: Update link)
* Forkに成功すると `https://github.com/<your github id>/mercari-build-training-2022`
というようなリポジトリができます。

## Gitの基本コマンドを使う

1. `https://github.com/<your github id>/mercari-build-training-2022`**clone**
します。 cloneすると、github上のリポジトリを自分のローカルにDownloadできます。
```shell
$ cd <your working space>
$ git clone https://github.com/<your github id>/mercari-build-training-2022
```
2. `first-pull-request`というブランチを作り、そのブランチに**checkout**します
```shell
$ cd <your working space>/mercari-build-training-2022
$ git branch first-pull-request
$ git checkout first-pull-request
```
3. README.md の中にある`@<your github id>` の部分をあなたのgithub idに書き換えてください
4. 書き換えた内容を **commit**します
```shell
$ git status # Check your change
$ git add README.md # README.mdの変更をcommit対象にする
$ git commit -m "Update github id" # どんな変更を加えたのかを伝えるコメント
```
5. 変更内容をgithubに**push**します
```shell
$ git push origin first-pull-request:first-pull-request
```
6. `https://github.com/<your github id>/mercari-build-training-2022`を開き、**Pull Request**(PR)を作ります。
- base branch: `main`
- target branch: `first-pull-request`

## PRのレビューをする、PRのレビューをもらう
- PRができたら、チームメイトにそのPRのURLを見てもらいます
- 1人以上に`approve`をもらえたらそのPRをmainブランチにmergeします
- また、チームメイトのPRを開いて **変更内容を確認**し、`approve` しましょう。

---

**:book: Reference**
- [コードレビューの仕方](https://fujiharuka.github.io/google-eng-practices-ja/ja/review/reviewer/)

**:beginner: Point**

以下のキーワードについて理解できているか確認しましょう。

- branch
- commit
- add
- pull, push
- Pull Request

---
### Next

[STEP2: 環境構築](document/step2.ja.md)
108 changes: 108 additions & 0 deletions document/step2.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# STEP2: Building local environment

Choose either Python or Go and build your local environment.

---
## Building Python environment

### 1. Install Python
* If your local version is below Python3.7, install Python3.10.
* If you have Python3.7 or above, you can skip the installation step.

### 2. Check your Python version

* Check if the Python is added to your PATH (usable as commands on your terminal) with the following command.

```shell
$ python -V
```

If the version does not correspond to the Python version you installed, double check your installation as it is not **added to your PATH**.

**:book: Reference**

* [Python - Environment Setup: Setting up PATH](https://www.tutorialspoint.com/python/python_environment.htm)

### 3. Install dependencies

The list of dependent libraries is written in a file called `requirements.txt` in a typical Python project.
You can install the dependencies by running the following command.

```shell
$ cd python
$ pip install -r requirements.txt
```

If you added a library, make sure you add it to `requirements.txt`.

### 4. Run the Python app

```shell
$ uvicorn main:app --reload --port 9000
```

If successful, you can access the local host `http://127.0.0.1:9000` on our browser and you will see`{"message": "Hello, world!"}`.

---

## Building Go environment
### 1. Install Go
* If your local version is below Go1.14, install Go1.18.
* If you have Go1.14 or above, you can skip the installation step.

### 2. Check your Go version

* Check if Go is added to your PATH (usable as commands on your terminal) with the following command.


```shell
$ go version
```

If the version does not correspond to the Python version you installed, double check your installation as it is not **added to your PATH**.

**:book: Reference**

* [GOROOT and GOPATH](https://www.jetbrains.com/help/go/configuring-goroot-and-gopath.html)

### 3. Install dependencies

In Go, dependent libraries are managed in a file called `go.mod`.
You can install the dependencies by running the following command.

```shell
$ cd go
$ go mod tidy
```

**:beginner: Point**

Understand the role of `go.mod` and the commands around it referring to this [document](https://pkg.go.dev/cmd/go#hdr-The_go_mod_file).

### 4. Run the Go app

```shell
$ go run app/main.go
```

If successful, you can access the local host `http://127.0.0.1:9000` on our browser and you will see`{"message": "Hello, world!"}`.

---
**:beginner: Points**

* If you're using Linux or Mac, understand when and how `.bash_profile` and `.bashrc` are activated and used (or `.zshrc` if you're using zsh).
* Understand what it means to **add to PATH**.

**:book: Reference**

The following resources are useful to dive deeper into building environments and Linux.

* [An Introduction to Linux Basics](https://www.digitalocean.com/community/tutorials/an-introduction-to-linux-basics)
* [Linux Mastery: Master the Linux Command Line in 11.5 Hours](https://www.udemy.com/course/linux-mastery/)
* You do NOT have to memorize the commands!

---

### Next

[STEP3: Make a listing API](document/step3.en.md)
Loading

0 comments on commit 4daaf07

Please sign in to comment.