Skip to content

Commit 5553b1d

Browse files
Initial commit
0 parents  commit 5553b1d

28 files changed

Lines changed: 1786 additions & 0 deletions

.env.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Database
2+
MONGO_URI=mongodb://localhost:27017/auth_api
3+
4+
# Server
5+
PORT=3000
6+
NODE_ENV=development
7+
8+
# JWT Configuration
9+
# IMPORTANT: Change this to a long, random string in production!
10+
# Generate with: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
11+
JWT_SECRET=change-this-to-a-super-secret-key-in-production-minimum-32-characters
12+
JWT_EXPIRES_IN=24h

.github/classroom/autograding.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"tests": [
3+
{
4+
"name": "01 - Health Check",
5+
"setup": "npm ci",
6+
"run": "NODE_OPTIONS=--experimental-vm-modules npx jest tests/visible/01-health.spec.js --verbose",
7+
"timeout": 30,
8+
"points": 5
9+
},
10+
{
11+
"name": "02 - Database Connection",
12+
"setup": "",
13+
"run": "NODE_OPTIONS=--experimental-vm-modules npx jest tests/visible/02-connect.spec.js --verbose",
14+
"timeout": 30,
15+
"points": 10
16+
},
17+
{
18+
"name": "03 - User Registration",
19+
"setup": "",
20+
"run": "NODE_OPTIONS=--experimental-vm-modules npx jest tests/visible/03-register.spec.js --verbose",
21+
"timeout": 30,
22+
"points": 20
23+
},
24+
{
25+
"name": "04 - Login & JWT",
26+
"setup": "",
27+
"run": "NODE_OPTIONS=--experimental-vm-modules npx jest tests/visible/04-login.spec.js --verbose",
28+
"timeout": 30,
29+
"points": 20
30+
},
31+
{
32+
"name": "05 - Protected Routes",
33+
"setup": "",
34+
"run": "NODE_OPTIONS=--experimental-vm-modules npx jest tests/visible/05-protected.spec.js --verbose",
35+
"timeout": 30,
36+
"points": 25
37+
},
38+
{
39+
"name": "06 - Role-Based Authorization",
40+
"setup": "",
41+
"run": "NODE_OPTIONS=--experimental-vm-modules npx jest tests/visible/06-roles.spec.js --verbose",
42+
"timeout": 30,
43+
"points": 20
44+
}
45+
]
46+
}

.github/workflows/classroom.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: GitHub Classroom Workflow
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
checks: write
9+
actions: read
10+
contents: read
11+
12+
jobs:
13+
build:
14+
name: Autograding
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: "20"
23+
cache: "npm"
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: GitHub Classroom Autograding
29+
uses: education/autograding@v1

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Environment variables
5+
.env
6+
7+
# Logs
8+
*.log
9+
npm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
13+
# Coverage
14+
coverage/
15+
16+
# macOS
17+
.DS_Store
18+
19+
# IDE
20+
.vscode/
21+
.idea/
22+
*.swp
23+
*.swo
24+
*~
25+
26+
# Test artifacts
27+
.jest/
28+
INSTRUCTOR-NOTES.md
29+
SOLUTION.md
30+
template-guide.md

0 commit comments

Comments
 (0)