-
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.
|#1 | @RashJrEdmund | installed express and configured base project t…
…emplate. setup hustky, prettier, and eslint. also updated readme file
- Loading branch information
1 parent
a784455
commit 03734ca
Showing
26 changed files
with
558 additions
and
2 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,2 @@ | ||
PORT="8080" | ||
NODE_ENV="dev" |
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,13 @@ | ||
{ | ||
"rules": { | ||
"quotes": ["warn", "double", { "avoidEscape": true }], | ||
"semi": ["warn", "always"], | ||
"indent": ["warn", 2], | ||
"class-methods-use-this": "warn", | ||
"eol-last": ["warn", "always"], | ||
"no-unused-vars": ["warn"], | ||
"no-unused-expressions": ["warn"], | ||
"no-multiple-empty-lines": ["warn", { "max": 1 }], | ||
"no-trailing-spaces": ["warn"] | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": [ | ||
"development" | ||
], | ||
"hints": { | ||
"disown-opener": "off" | ||
} | ||
} |
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,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm run pre-commit |
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,9 @@ | ||
.next | ||
.cache | ||
package-lock.json | ||
public | ||
node_modules | ||
next-env.d.ts | ||
next.config.ts | ||
yarn.lock | ||
src/components/ui |
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,6 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": false | ||
} |
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,2 +1,74 @@ | ||
# WMA_HackKmer_Yaounde_Backend | ||
REST API server for WMA HackKmer Yaounde at Rebase Code Camp | ||
# wiki-lex-match | ||
|
||
__table of content__ | ||
|
||
- [local setup](#setup-repo-locally) | ||
- [how to render the](#how-to-render-the-documentation) | ||
- [contributing](#contributing) | ||
|
||
## setup repo locally | ||
|
||
- Clone repo with | ||
|
||
```bash | ||
git clone git@github.com:Wikidata-Cameroon/WMA_HackKmer_Yaounde_Backend.git wiki-lex-match-backend | ||
``` | ||
|
||
- Navigate to project with from your terminal | ||
|
||
```bash | ||
cd wiki-lex-match-backend | ||
``` | ||
|
||
## How to start server | ||
|
||
- Start local server in watch mode | ||
|
||
```bash | ||
npm run dev | ||
``` | ||
|
||
- Build to js | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
## Contributing | ||
|
||
- __Git flow__ | ||
|
||
- Branches should be name with `feature/<task>` format | ||
|
||
- Writing commits | ||
- Commit messages should follow the for mat `#<issue_number> | <author_name> | <work_description>` | ||
|
||
- @example is `"|#1 | @rashjredmund | installed express and configured base project template. setup hustky, prettier, and eslint. also updated readme file"` | ||
|
||
- The numbering is with respect to the issue number your are working on | ||
|
||
- When creating a `PR`; | ||
|
||
- If that pr is for an existing `issue`, be sure to tag the issue in the PR description, to auto-close the issue if it's approved, you can use any of these commands | ||
- `Resolves #<issue_number>` | ||
- `Fixes #<issue_number>` or | ||
- `Closes #<issue_number>` | ||
- Always assign the PR to yourself and your team-mate | ||
- __Building__ | ||
- Navigate to `src/modules/<your_module_of_concern>` to start contributing | ||
- Set up your routes in the `src/route/*` directory in the right file or add one if need be | ||
- Set up your route handlers in the `<module-name>.controller.ts` file and add the endpoints to the corresponding route in `src/routes/*` directory | ||
| | ||
___ | ||
__Happy Coding Everyone 🚀__ |
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 @@ | ||
{ | ||
"watch": [ | ||
"src/" | ||
], | ||
"ext": "ts,json", | ||
"ignore": [ | ||
"src/**/*.spec.ts" | ||
], | ||
"exec": "npx ts-node ./src/main.ts" | ||
} |
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,46 @@ | ||
{ | ||
"name": "wiki-lex-match", | ||
"version": "1.0.0", | ||
"description": "The API for wiki-lex-match", | ||
"main": "main.js", | ||
"lint-staged": { | ||
"src/**/*.ts": [ | ||
"npm run format" | ||
] | ||
}, | ||
"scripts": { | ||
"test": "jest", | ||
"start": "node ./dist/main.js", | ||
"dev": "npx nodemon", | ||
"build": "rm -rf ./dist && npx tsc", | ||
"format": "npx prettier --config ./.prettierrc.json --write ./src", | ||
"format:check": "npx prettier --config ./.prettierrc.json --check ./src", | ||
"prepare": "npx husky install", | ||
"pre-commit": "npx lint-staged" | ||
}, | ||
"keywords": [ | ||
"wikimedia", | ||
"lex-match", | ||
"wiki-lex-match", | ||
"wikicommon", | ||
"wikidata" | ||
], | ||
"author": "Wiki mentor Africa Cameroon - Yaounde", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@types/cors": "^2.8.17", | ||
"@types/dotenv": "^8.2.0", | ||
"@types/express": "^4.17.21", | ||
"@types/node": "^22.2.0", | ||
"nodemon": "^3.1.4", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.5.4" | ||
}, | ||
"dependencies": { | ||
"cors": "^2.8.5", | ||
"dotenv": "^16.4.5", | ||
"express": "^4.19.2", | ||
"lint-staged": "^15.2.5", | ||
"prettier": "^3.3.3" | ||
} | ||
} |
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,64 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="description" content="wiki-lex-match"> | ||
|
||
<meta property="og:title" content="wiki-lex-match<"> | ||
<meta property="og:description" | ||
content="The API for wiki-lex-match, by Wiki mentor Africa Cameroon - Yaounde developer at rebase-code-camp"> | ||
<meta property="og:site_name" content="wiki-lex-match"> | ||
<meta property="og:type" content="website"> | ||
|
||
<meta name="twitter:card" content="summary"> | ||
<meta name="twitter:title" content="wiki-lex-match"> | ||
<meta name="twitter:description" | ||
content="The API for wiki-lex-match, by Wiki mentor Africa Cameroon - Yaounde developer at rebase-code-camp"> | ||
|
||
<script src="https://cdn.tailwindcss.com"></script> | ||
|
||
<title>wiki-lex-match - 404 route</title> | ||
|
||
<style> | ||
* { | ||
box-sizing: border-box; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body class=""> | ||
<main class="min-h-screen flex flex-col items-center justify-center gap-3"> | ||
<div class="flex items-center justify-center gap-2"> | ||
<h1 class="font-semibold text-[2rem] md:text-[3.4rem] lg:text-[5rem] text-blue-500"> | ||
404 | ||
</h1> | ||
|
||
<div class="w-fit flex flex-col items-start justify-start gap-1"> | ||
<p class="text-sm text-gray-400 w-fit"> | ||
Route not found | ||
</p> | ||
|
||
<a href="/" class="bg-slate-900 rounded px-8 py-3 text-white cursor-pointer"> | ||
Home | ||
</a> | ||
</div> | ||
</div> | ||
|
||
<p class="text-gray-400"> | ||
cannot Get route: | ||
|
||
<span id="route" class="text-red-500"></span> | ||
</p> | ||
</main> | ||
|
||
</body> | ||
|
||
<script defer> | ||
document.getElementById("route").innerHTML = window.location.toString(); | ||
</script> | ||
|
||
</html> |
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,52 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="description" content="wiki-lex-match"> | ||
|
||
<meta property="og:title" content="wiki-lex-match<"> | ||
<meta property="og:description" | ||
content="The API for wiki-lex-match, by Wiki mentor Africa Cameroon - Yaounde developer at rebase-code-camp"> | ||
<meta property="og:site_name" content="wiki-lex-match"> | ||
<meta property="og:type" content="website"> | ||
|
||
<meta name="twitter:card" content="summary"> | ||
<meta name="twitter:title" content="wiki-lex-match"> | ||
<meta name="twitter:description" | ||
content="The API for wiki-lex-match, by Wiki mentor Africa Cameroon - Yaounde developer at rebase-code-camp"> | ||
|
||
<script src="https://cdn.tailwindcss.com"></script> | ||
|
||
<title>wiki-lex-match</title> | ||
|
||
<style> | ||
* { | ||
box-sizing: border-box; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body class=""> | ||
<main class="min-h-screen flex flex-col items-center justify-center"> | ||
<h1 class="font-semibold text-xl md:text-2xl text-blue-500"> | ||
welcome to wiki-lex-match | ||
</h1> | ||
|
||
<p class="text-sm text-gray-400"> | ||
By Wiki mentor Africa Cameroon - Yaounde developer at | ||
<a href="https://www.linkedin.com/company/rebasecodecamp/" class="text-blue-500 cursor-pointer" | ||
target="_blank">@rebase code camp</a> | ||
</p> | ||
|
||
<a href="/api-docs" | ||
class="bg-slate-900 rounded px-8 py-3 text-white duration-300 hover:scale-[1.02] cursor-pointer mt-6"> | ||
API docs | ||
</a> | ||
</main> | ||
</body> | ||
|
||
</html> |
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,8 @@ | ||
import { config } from "dotenv"; | ||
|
||
config(); | ||
|
||
export const APP_CONF = { | ||
port: process.env.PORT!, | ||
env: process.env.NODE_ENV as "dev" | "prod", | ||
}; |
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,19 @@ | ||
import express, { Application } from "express"; | ||
import App from "./server"; | ||
import { APP_CONF } from "./config/app-config"; | ||
|
||
(async () => { | ||
const app: Application = express(); | ||
|
||
const { port: PORT, env } = APP_CONF; | ||
|
||
App(app) | ||
.then(() => | ||
app.listen(PORT, () => | ||
console.log( | ||
`\nserver listening on ${env === "dev" ? "http://localhost:" : "port "}${PORT}` | ||
) | ||
) | ||
) | ||
.catch(console.error); | ||
})(); |
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,3 @@ | ||
/** | ||
* export middle wares from here | ||
*/ |
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,16 @@ | ||
import { type RequestHandler } from "express"; | ||
import { AuthService } from "./auth.service"; | ||
|
||
export class AuthController { | ||
private authService: AuthService; | ||
|
||
constructor() { | ||
this.authService = new AuthService(); | ||
} | ||
|
||
index: RequestHandler = (req, res) => { | ||
return res.status(200).json({ | ||
message: "Intergrade wikimedia OAuth 1.0a", | ||
}); | ||
}; | ||
} |
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,5 @@ | ||
export class AuthService { | ||
constructor() { | ||
// | ||
} | ||
} |
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,16 @@ | ||
import { type RequestHandler } from "express"; | ||
import { LanguageService } from "./language.service"; | ||
|
||
export class LanguageController { | ||
private languageService: LanguageService; | ||
|
||
constructor() { | ||
this.languageService = new LanguageService(); | ||
} | ||
|
||
getAllLanguageList: RequestHandler = (req, res) => { | ||
return res.status(200).json({ | ||
message: "return languages", | ||
}); | ||
}; | ||
} |
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,5 @@ | ||
export class LanguageService { | ||
constructor() { | ||
// | ||
} | ||
} |
Oops, something went wrong.