Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A1.3 #3

Open
wants to merge 1 commit into
base: a1.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _explicacoes/a1.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## A1.3: Reutilizando códigos entre projetos em monorepos

- [Board do Miro: Visualizando o monorepo](https://miro.com/app/board/uXjVK_HQUgI=/?share_link_id=740758431712)
7 changes: 7 additions & 0 deletions apps/company-front/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
"use client";
import { httpClient } from "@devsoutinho/commons-http-client";

export default function Page() {
httpClient
.get("https://api.github.com/users/omariosouto")
.then((data) => console.log(data))

return <h1>Hello, world!</h1>
}
1 change: 1 addition & 0 deletions apps/company-front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@devsoutinho/commons-http-client": "*",
"next": "^14.2.3",
"react": "^18.3.1",
"react-dom": "^18.3.1"
Expand Down
14 changes: 14 additions & 0 deletions commons/http-client/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

export const httpClient = {
get(url: string) {
return fetch(url, {
headers: {
"accept": "application/json"
},
})
.then((res) => res.json())
.then((data) => {
return data;
});
}
}
12 changes: 12 additions & 0 deletions commons/http-client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@devsoutinho/commons-http-client",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}
32 changes: 25 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
"description": "",
"main": "index.js",
"workspaces": [
"apps/*"
"apps/*",
"commons/*"
],
"scripts": {
"front": "npm exec --workspace=company-front",
"dev:front": "npm run front -- npm run dev",
"server": "npm exec --workspace=company-server",
"dev:server": "npm run server -- npm run dev"
"dev:server": "npm run server -- npm run dev",
"demo": "echo 'ola pessoas'"
},
"keywords": [],
"author": "",
Expand Down