Skip to content
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
119c821
add mocha.opts,update package.json,add project_directory_structure.md…
Defirence Apr 7, 2025
73c52e5
update the file extension of project_directory_structure.md to .txt
Defirence Apr 7, 2025
3e670fc
fix workflow
Defirence Apr 10, 2025
14a51a9
add branch rule for tests branch
Defirence Apr 10, 2025
ad21571
disable SSH-key auth in favour of HTTPS clone
Defirence Apr 10, 2025
07a77f6
optimize the workflow file
Defirence Apr 10, 2025
25f0934
add exisiting yarn.lock to root path of repo
Defirence Apr 10, 2025
0599e10
migrate from .json eslint config to new spec, update webserver logic …
Defirence Apr 10, 2025
b20be9d
Merge branch 'tests' of https://github.com/Defirence/javascript into …
Defirence Apr 10, 2025
4220015
add eslint.config.mjs to root of monorepo structure.
Defirence Apr 10, 2025
47c64e3
update node-version variable to use 22 instead of 16(?)
Defirence Apr 10, 2025
db8f591
update project workflow structure dependencies for monorepo structure
Defirence Apr 10, 2025
7c72ea5
restructure entire project for easier management.
Defirence Apr 10, 2025
ebeb6e2
update path for tests and linting
Defirence Apr 10, 2025
65f8c7b
update the workflow to verify the lock file exists
Defirence Apr 10, 2025
b8bcc55
commit and push yarn.lock to root of repo.
Defirence Apr 10, 2025
57e3eb1
update workflow spec again
Defirence Apr 10, 2025
75c78a0
update workflow path
Defirence Apr 10, 2025
eec47ab
update workflow
Defirence Apr 10, 2025
e319b67
remove yarn lockfile verification step
Defirence Apr 10, 2025
89894f3
update working-dir path
Defirence Apr 10, 2025
cd2b9d1
update linting workflow, add badge for Mocha tests
Defirence Apr 10, 2025
f473297
update README with badges and update linting workflow
Defirence Apr 10, 2025
aec2361
update root readme.md before merge to main
Defirence Apr 10, 2025
208f065
Update webserver logic
Defirence Apr 21, 2025
a6fd0c8
Merge branch 'main' into tests
Defirence Apr 21, 2025
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
11 changes: 5 additions & 6 deletions node-express-server/webserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ app.use((req, res, next) => {
});

app.get('/', (req, res) => {
const userAgent = new UserAgents().toString();
res.status(200).json({ message: 'Hello Express!' }); // Respond with JSON
console.log(`Received GET request to the API with userAgent:`);
console.log(userAgent.toString());
console.log(`Received GET request to the API with userAgent: ${userAgent}`);
});

app.post('/', (req, res) => {
Expand All @@ -35,18 +35,17 @@ app.put('/user', (req, res) => {
throw new Error('Simulated server error');
}
res.status(200).json({ message: 'Resource updated successfully' });
console.log(`Received PUT request from port: ${port} to ${dir}userAgent:`);
console.log(userAgent.toString());
console.log(`Received PUT request from port: ${port} to ${dir} userAgent: ${userAgent}`);
} catch (error) {
res.status(500).json({ error: 'Internal server error' }); // Handle server error
console.error('Error occurred on PUT /user:', error.message);
}
});

app.delete('/user', (req, res) => {
const userAgent = new UserAgents().toString();
res.status(204).send(); // Respond with 204 for successful deletion
console.log(`Received DELETE request from port: ${port} to ${dir}userAgent:`);
console.log(userAgent.toString());
console.log(`Received DELETE request from port: ${port} to ${dir} userAgent: ${userAgent}`);
});

// POST /user route
Expand Down