Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bee2be487 | ||
|
|
e8a63533b5 | ||
|
|
09b1730954 | ||
|
|
9d9470b8cd | ||
|
|
590a50d959 | ||
|
|
db330b3fad | ||
|
|
1073d8dfde | ||
|
|
e14262db4d | ||
|
|
b2c00cd23d | ||
|
|
f323549ae7 | ||
|
|
60de2961b2 | ||
|
|
0780e1e794 | ||
|
|
5ad17323dd |
@@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
.env
|
||||
*.log
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Verify Node.js') {
|
||||
steps {
|
||||
sh 'node --version'
|
||||
sh 'npm --version'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Install Dependencies') {
|
||||
steps {
|
||||
sh 'npm ci'
|
||||
}
|
||||
}
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'npm run lint'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
sh 'npm test'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+36
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "seat-back-trivia",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "seat-back-trivia",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"ws": "8.18.3"
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.18.3",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz",
|
||||
"integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": ">=5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "seat-back-trivia",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "Minimal WebSocket quiz server for SeatBack Trivia",
|
||||
"scripts": {
|
||||
"lint": "node --check server.js && node --check server.test.js",
|
||||
"test": "node --test"
|
||||
},
|
||||
"dependencies": {
|
||||
"ws": "8.18.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
const WebSocket = require('ws');
|
||||
|
||||
const PORT = process.env.PORT || 8080;
|
||||
const wss = new WebSocket.Server({ port: PORT });
|
||||
|
||||
const question = {
|
||||
question: 'What is the capital of France?',
|
||||
answer: 'Paris'
|
||||
};
|
||||
|
||||
wss.on('connection', (ws) => {
|
||||
ws.send(JSON.stringify(question));
|
||||
});
|
||||
|
||||
console.log(`SeatBack Trivia WebSocket server listening on port ${PORT}`);
|
||||
@@ -0,0 +1,11 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
test('sample trivia question has the expected answer', () => {
|
||||
const question = {
|
||||
question: 'What is the capital of France?',
|
||||
answer: 'Paris'
|
||||
};
|
||||
|
||||
assert.equal(question.answer, 'Paris');
|
||||
});
|
||||
Reference in New Issue
Block a user