Skip to content

Commit

Permalink
[SLT-157] feat(rest-api): Refactor for RESTful architectural standard…
Browse files Browse the repository at this point in the history
…ization (#3126)

* RESTful refactor

* Adds controllers and routes
* Validations
* Middleware for error handling
* Adds tests

---------

Co-authored-by: defi-moses <[email protected]>
  • Loading branch information
abtestingalpha and Defi-Moses authored Sep 16, 2024
1 parent 265aff4 commit e1d45dc
Show file tree
Hide file tree
Showing 42 changed files with 2,879 additions and 697 deletions.
3 changes: 3 additions & 0 deletions packages/rest-api/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env", "@babel/preset-typescript"]
}
8 changes: 8 additions & 0 deletions packages/rest-api/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
module.exports = {
extends: '../../.eslintrc.js',
overrides: [
{
files: ['jest.config.js'],
rules: {
'prettier/prettier': 'off',
},
},
],
}
10 changes: 10 additions & 0 deletions packages/rest-api/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/src'],
transform: {
'^.+\\.(ts|tsx)$': 'babel-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleDirectories: ['node_modules', 'src'],
}
15 changes: 12 additions & 3 deletions packages/rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
"scripts": {
"build": "tsc",
"build:go": " ",
"dev": "nodemon --watch src --exec ts-node src/app.ts",
"start": "node dist/app.js",
"lint:fix": "eslint src/**/*.ts --fix",
"lint:check": "eslint . --max-warnings=0",
"ci:lint": "npm run lint:check",
"test": "tsdx test",
"test": "jest",
"test:coverage": "echo 'No tests defined.'",
"postinstall": "npm run build"
},
Expand All @@ -24,15 +25,23 @@
"bignumber": "^1.1.0",
"ethers": "5.7.2",
"express": "^4.18.2",
"lodash": "^4.17.21",
"supertest": "^6.3.3"
"express-validator": "^7.2.0",
"lodash": "^4.17.21"
},
"description": "A node.js project exposing a rest api for synapse sdk quotes",
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.4",
"@babel/preset-typescript": "^7.24.7",
"@types/jest": "^29.5.13",
"@types/supertest": "^6.0.2",
"concurrently": "^8.2.0",
"jest": "^29.7.0",
"lodash": "^4.17.21",
"nodemon": "^3.0.1",
"supertest": "^6.3.3",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^4.8.3"
}
}
Loading

0 comments on commit e1d45dc

Please sign in to comment.