-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from SantiagoJavierRubio/presentation
Presentation edits
- Loading branch information
Showing
9 changed files
with
7,284 additions
and
7,288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Ports | ||
CLIENT_PORT= | ||
SERVER_PORT= | ||
|
||
# Auth | ||
GITHUB_TOKEN= | ||
|
||
# Repo data | ||
REPO_OWNER= | ||
REPO_NAME= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,66 @@ | ||
# Git commit history | ||
# Git commit history | ||
### Fullstack webapp to show commit history of a single repo. Built with NestJS and React | ||
|
||
Take-Home test made for Fulltimeforce selection process | ||
|
||
## Instructions | ||
Start by cloning this repo | ||
``` | ||
git clone https://github.com/SantiagoJavierRubio/git-commit-history.git | ||
``` | ||
Then access new repo folder | ||
``` | ||
cd git-commit-history | ||
``` | ||
After that create a .env from [example](.env.example) file | ||
``` | ||
copy .env.example .env | ||
``` | ||
|
||
### Fill out your new .env fields | ||
> *CLIENT_PORT* --> localhost port to run client app | ||
> | ||
> **SERVER_PORT** --> localhost port to run nest app -> **required** | ||
> | ||
> **GITHUB_TOKEN** --> your own github token [(More info)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic) -> **required** | ||
> | ||
> *REPO_OWNER* --> leave empty to use this repository's data, else add the owner name of the repo you want to use | ||
> | ||
> *REPO_NAME* --> leave empty to use this repository's data, else add the repository name you want to use | ||
Install packages | ||
``` | ||
yarn | ||
# or | ||
npm install | ||
# or | ||
pnpm install | ||
``` | ||
|
||
Run app | ||
``` | ||
yarn dev | ||
# or | ||
npm run dev | ||
# or | ||
pnpm dev | ||
``` | ||
|
||
And both client and server should be available at http://localhost: \<Your configured ports> | ||
|
||
# Techs used | ||
|
||
* [Turborepo](https://turbo.build/repo) | ||
* [Typescript](https://www.typescriptlang.org/) | ||
* [Vite](https://vitejs.dev/) | ||
* [React](https://react.dev/) | ||
* [Nest](https://nestjs.com/) | ||
* [Tanstack Query](https://tanstack.com/query/v4/docs/react/overview) | ||
* [Tanstack Table](https://tanstack.com/table/v8) | ||
* [Swagger](https://swagger.io/specification/) | ||
* [TailwindCSS](https://tailwindcss.com/) | ||
|
||
# External APIs | ||
|
||
* [Github Api](https://docs.github.com/en/rest?apiVersion=2022-11-28) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import axios from 'axios' | ||
import type {} from 'types' | ||
|
||
const serverPort = import.meta.env.SERVER_PORT | ||
|
||
export default function getCommits() { | ||
return axios.get('http://localhost:3000/commits').then(res => res.data) | ||
return axios.get(`http://localhost:${serverPort}/commits`).then(res => res.data) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
import { z } from 'zod' | ||
|
||
function validatePossiblyEmptyString(input: string, defaultVal: string) { | ||
const parsed = z.string().min(1).safeParse(input) | ||
return parsed.success ? parsed.data : defaultVal | ||
} | ||
|
||
export default () => ({ | ||
NODE_ENV: process.env.NODE_ENV || 'development', | ||
githubToken: process.env.GITHUB_TOKEN, | ||
repo: { | ||
owner: process.env.REPO_OWNER ?? 'SantiagoJavierRubio', | ||
name: process.env.REPO_NAME ?? 'git-commit-history' | ||
} | ||
owner: validatePossiblyEmptyString(process.env.REPO_OWNER, 'SantiagoJavierRubio'), | ||
name: validatePossiblyEmptyString(process.env.REPO_NAME, 'git-commit-history') | ||
}, | ||
PORT: process.env.SERVER_PORT | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import { NestFactory } from '@nestjs/core' | ||
import { AppModule } from './app.module' | ||
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger/dist' | ||
import { ConfigService } from '@nestjs/config' | ||
|
||
async function bootstrap() { | ||
const app = await NestFactory.create(AppModule, { cors: true }) | ||
const config = app.get(ConfigService) | ||
const swaggerConfig = new DocumentBuilder() | ||
.setTitle('Git commit history API') | ||
.setVersion('1.0') | ||
.addTag('commits') | ||
.build() | ||
const document = SwaggerModule.createDocument(app, swaggerConfig) | ||
SwaggerModule.setup('', app, document) | ||
await app.listen(3000) | ||
await app.listen(config.get('PORT')) | ||
} | ||
bootstrap() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.