Skip to content
This repository was archived by the owner on Jun 19, 2023. It is now read-only.

Commit 6a80a2b

Browse files
committed
Initial commit
0 parents  commit 6a80a2b

File tree

10 files changed

+3846
-0
lines changed

10 files changed

+3846
-0
lines changed

.eslintrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module.exports = {
2+
ignorePatterns: ['**/*.js', '**/*.d.ts'],
3+
env: {
4+
browser: true,
5+
es2021: true
6+
},
7+
extends: [
8+
'eslint:recommended',
9+
'plugin:@typescript-eslint/recommended',
10+
'plugin:prettier/recommended'
11+
],
12+
parser: '@typescript-eslint/parser',
13+
parserOptions: {
14+
ecmaVersion: 12,
15+
sourceType: 'module'
16+
},
17+
plugins: ['@typescript-eslint'],
18+
rules: {
19+
'prettier/prettier': 'error',
20+
'@typescript-eslint/explicit-member-accessibility': 0,
21+
'@typescript-eslint/explicit-function-return-type': 0,
22+
'@typescript-eslint/no-explicit-any': 0,
23+
'@typescript-eslint/no-use-before-define': [0],
24+
'@typescript-eslint/no-empty-function': [1],
25+
'@typescript-eslint/ban-ts-ignore': [0],
26+
'@typescript-eslint/no-var-requires': [1],
27+
'@typescript-eslint/explicit-module-boundary-types': 0
28+
}
29+
};

.gitignore

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.env.test
107+
.env/
108+
.envs/
109+
.venv/
110+
env/
111+
venv/
112+
ENV/
113+
env.bak/
114+
venv.bak/
115+
Pipfile
116+
Pipfile.lock
117+
118+
# Spyder project settings
119+
.spyderproject
120+
.spyproject
121+
122+
# Rope project settings
123+
.ropeproject
124+
125+
# mkdocs documentation
126+
/site
127+
128+
# mypy
129+
.mypy_cache/
130+
.dmypy.json
131+
dmypy.json
132+
133+
# Pyre type checker
134+
.pyre/
135+
136+
.idea/
137+
138+
.vscode/
139+
.tool-versions
140+
.DS_Store
141+
142+
node_modules/
143+
tsconfig.tsbuildinfo

.prettierrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
singleQuote: true,
3+
tabWidth: 2,
4+
trailingComma: 'none',
5+
useTabs: false
6+
};

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Origin Node.js Challenge
2+
3+
Node.js challenge for backend candidates
4+
5+
## Requirements
6+
7+
- Node.js >= v14.0
8+
- Yarn >= v1.22
9+
10+
## Installation
11+
12+
In project's directory, run the following commands:
13+
14+
```
15+
yarn install
16+
```
17+
18+
## Running locally
19+
20+
To run the project locally with hot reload:
21+
22+
```
23+
yarn dev
24+
```
25+
26+
### Lint
27+
28+
To view lint issues:
29+
30+
31+
```
32+
yarn lint
33+
```
34+
35+
To fix them:
36+
37+
```
38+
yarn lint:fix
39+
```

jest.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
transform: {
3+
'^.+\\.ts?$': 'ts-jest',
4+
},
5+
roots: ["./tests"]
6+
};

package.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "origin-nodejs-challenge",
3+
"version": "1.0.0",
4+
"description": "Origin challenge for backend candidates",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "jest",
8+
"dev": "nodemon -e ts --watch src --exec \"tsc && node dist/index.js\"",
9+
"lint": "eslint './src/**/*.{ts,tsx}' './src/**/*.{ts,tsx}' --quiet",
10+
"lint:fix": "yarn lint --fix"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "git+https://github.com/OriginFinancial/origin-nodejs-challenge.git"
15+
},
16+
"keywords": [
17+
"origin",
18+
"nodejs",
19+
"backend",
20+
"challenge"
21+
],
22+
"author": "Origin Engineers",
23+
"license": "ISC",
24+
"dependencies": {
25+
"axios": "^0.27.2",
26+
"express": "^4.18.1"
27+
},
28+
"devDependencies": {
29+
"@types/axios-mock-adapter": "^1.10.0",
30+
"@types/express": "^4.17.14",
31+
"@types/jest": "^29.0.3",
32+
"@types/supertest": "^2.0.12",
33+
"@typescript-eslint/eslint-plugin": "^5.38.0",
34+
"@typescript-eslint/parser": "^5.38.0",
35+
"axios-mock-adapter": "^1.21.2",
36+
"eslint": "^8.23.1",
37+
"eslint-config-prettier": "^8.5.0",
38+
"eslint-plugin-prettier": "^4.2.1",
39+
"jest": "^29.0.3",
40+
"nodemon": "^2.0.20",
41+
"prettier": "^2.7.1",
42+
"supertest": "^6.2.4",
43+
"ts-jest": "^29.0.1",
44+
"typescript": "^4.8.3"
45+
}
46+
}

src/controllers/pokemon.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Request, Response, Router } from 'express';
2+
3+
const router = Router();
4+
router.get('/', (_req: Request, res: Response) => {
5+
res.send('Hello World');
6+
});
7+
8+
export default router;

src/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import express from 'express';
2+
import pokemonController from './controllers/pokemon';
3+
4+
const app = express();
5+
app.use('/', pokemonController);
6+
7+
export const server = app.listen(3000, () =>
8+
console.log(`🚀 Started on port 3000`)
9+
);

tsconfig.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"noImplicitAny": false,
4+
"target": "es2016",
5+
"module": "commonjs",
6+
"isolatedModules": false,
7+
"esModuleInterop": true,
8+
"forceConsistentCasingInFileNames": true,
9+
"strict": true,
10+
"skipLibCheck": true,
11+
"allowJs": true,
12+
"types": ["node", "jest", "express"],
13+
"typeRoots": ["./node_modules/@types"],
14+
"rootDir": "./src",
15+
"outDir": "./dist",
16+
},
17+
"include": ["./src"],
18+
"exclude": ["./node_modules", "./tests"]
19+
}

0 commit comments

Comments
 (0)