Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e1235d3
relocate frontend and setup backend environment
minhngo3818 Aug 13, 2022
7b248c4
reorganize directories
minhngo3818 Aug 13, 2022
2b66bc7
Merge branch 'main' of https://github.com/Computer-Science-Club-OCC/C…
minhngo3818 Aug 14, 2022
39390b2
update, add gitignore, modify workflow
minhngo3818 Aug 14, 2022
677be79
minor updates
minhngo3818 Aug 16, 2022
3c4e74f
setup axios & eslint-prettier for backend
minhngo3818 Aug 16, 2022
f9dac7b
setup jest for testing
minhngo3818 Aug 16, 2022
8d1b3f6
setup git pages
minhngo3818 Aug 18, 2022
93c0f65
completed backend setup & add axios for api
minhngo3818 Aug 27, 2022
15a5a8b
setup testing environment
minhngo3818 Aug 27, 2022
4223df9
Merge 'main' into setup-backend-env client
minhngo3818 Aug 29, 2022
70be5e0
fix bug
minhngo3818 Aug 29, 2022
583eea6
re-allocate diretories
minhngo3818 Aug 29, 2022
61784a9
config jest, add dummy test & naming convention
minhngo3818 Aug 30, 2022
77724ad
change it into test for readability
minhngo3818 Aug 31, 2022
1a3581b
add tags model
minhngo3818 Aug 31, 2022
016e321
update .env file
minhngo3818 Aug 31, 2022
8ac0107
fix typo
minhngo3818 Aug 31, 2022
beddac4
remove unnecessary code
minhngo3818 Aug 31, 2022
3b7cad7
replace handleError with console.log()
minhngo3818 Aug 31, 2022
ba3b027
add imageSchema to eventSchema
minhngo3818 Aug 31, 2022
2d332ac
refactor description into detail
minhngo3818 Aug 31, 2022
82e51fb
remove unused code in activity
minhngo3818 Sep 1, 2022
20fb051
add external gitignore
minhngo3818 Sep 1, 2022
74eec15
add new line in external gitignore
minhngo3818 Sep 1, 2022
0c05056
remove body parser due to express v4
minhngo3818 Sep 2, 2022
01b6456
use built-in express parser
minhngo3818 Sep 2, 2022
a756024
add controllers, framework, tags-route
minhngo3818 Sep 2, 2022
0d8929b
Fixed broken workflow bc/ of refactor
KHVBui Sep 2, 2022
80c3b7c
add rules, remove unused plugins, add format:diff
minhngo3818 Sep 3, 2022
214b3db
comment unused imports & format
minhngo3818 Sep 3, 2022
d6831da
Merge pull request #70 from Computer-Science-Club-OCC/bug-fix-workflo…
minhngo3818 Sep 3, 2022
e4b5f4f
add import plugin
minhngo3818 Sep 3, 2022
41828a3
Merge branch 'setup-backend-env' of https://github.com/Computer-Scien…
minhngo3818 Sep 3, 2022
7b6bf77
add plugin n
minhngo3818 Sep 3, 2022
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
44 changes: 41 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ on:
workflow_dispatch:

jobs:
build_test:

client:
runs-on: ${{ matrix.os }}
env:
CI: false
CI: false # Do not treat warnings as errors
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: [14.x]
defaults:
run:
working-directory: ./client # For subdir

steps:
- uses: actions/checkout@v3
Expand All @@ -34,7 +36,43 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: './client/package-lock.json' # For subdir

- name: Install packages
run: npm ci

- name: Prettier
run: npm run format:diff

- name: Lint
run: npm run lint

- run: npm run build --if-present


backend:
runs-on: ${{ matrix.os }}
env:
CI: false # Do not treat warnings as errors
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: [14.x]
defaults:
run:
working-directory: ./backend # For subdir

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: './backend/package-lock.json' # For subdir

- name: Install packages
run: npm ci

Expand Down
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# Ignoring packages
*.zip
*.tar.gz
*.rar

# Ignore vscode
.vscode/

# Ignore JetBrain IDE
.idea/

# Ignore sublime files
*.sublime-workspace

# Ignore package-lock.json
package-lock.json
package.json

# Ignore dependencies generated in root
# dependencies
/node_modules
/.pnp
Expand Down
3 changes: 3 additions & 0 deletions backend/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# NOTES: This file will not be included in actual deployment !!
PORT=8000
DATABASE_URI=mongodb://localhost:27017/cs_club
File renamed without changes.
45 changes: 45 additions & 0 deletions backend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": true,
"node": true,
"jest/globals": true
},
"extends": [
"standard",
"eslint:recommended",
"plugin:promise/recommended",
"plugin:jest/recommended",
"plugin:prettier/recommended"
],
"plugins": ["jest", "prettier"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"prettier/prettier": "error",
"no-unused-expressions": "error",
"no-unused-vars": "warn",
"no-empty-function": "error",
"no-underscore-dangle": "off",
"promise/always-return": "error",
"promise/no-return-wrap": "error",
"promise/param-names": "error",
"promise/catch-or-return": "error",
"promise/no-native": "off",
"promise/no-nesting": "warn",
"promise/no-promise-in-callback": "warn",
"promise/no-callback-in-promise": "warn",
"promise/avoid-new": "warn",
"promise/no-new-statics": "error",
"promise/no-return-in-finally": "warn",
"promise/valid-params": "warn",
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error"
}
}
23 changes: 23 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build
/static

# misc
.env
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
File renamed without changes.
6 changes: 6 additions & 0 deletions backend/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": false,
"singleQuote": false
}
1 change: 1 addition & 0 deletions backend/controllers/events/events-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// const events = require("../../models/events/events-model")
1 change: 1 addition & 0 deletions backend/controllers/orgs/organizations-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// const organizations = require("../../models/organizations/orgs-model")
1 change: 1 addition & 0 deletions backend/controllers/projects/projects-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// const projects = require("../../models/projects/projects-model")
1 change: 1 addition & 0 deletions backend/controllers/readings/readings-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// const readings = require("../../models/readings/readings-model")
1 change: 1 addition & 0 deletions backend/controllers/tags/tags-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// const tags = require("../../models/tags/tags-model")
1 change: 1 addition & 0 deletions backend/controllers/tutorials/tutorials-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// const tutorials = require("../../models/tutorials/tutorials-model")
1 change: 1 addition & 0 deletions backend/controllers/user/user-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// const user = require("../../models/user/user-model")
File renamed without changes.
36 changes: 36 additions & 0 deletions backend/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const express = require("express")
const app = express()
const mongoose = require("mongoose")
// const multer = require("multer")
const PORT = process.env.PORT || 8000
require("dotenv/config")

// Connect datbase and create collection
mongoose
.connect(
process.env.DATABASE_URI,
{ useNewUrlParser: true },
{ useUnifiedTopology: true },
() => console.log("Connected to datbase!")
)
.catch((error) => {
console.log(error)
})

// Parsing
app.use(express.urlencoded({ extended: true }))
app.use(express.json())

// Import Routes
// const eventsRoute = require("./routes/events/events-route")
// const projectsRoute = require("./routes/projects/projects-route")
// const tutorialsRoute = require("./routes/tutorials/tutorials-route")
// const readingsRoute = require("./routes/readings/readings-route")
// const organizationsRoute = require("./routes/organizations/orgs-route")

// Use Routes

// Run server
app.listen(PORT, () => {
console.log(`Running backend server on: http://localhost:${PORT}`)
})
Loading