Skip to content

Commit ab3999d

Browse files
Added backend templates and complete web setup except linter, tests
1 parent e64d056 commit ab3999d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+942
-207
lines changed

.vscode/launch.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Launch Program",
11+
"skipFiles": [
12+
"<node_internals>/**"
13+
],
14+
"program": "${workspaceFolder}/lib/index.js",
15+
"outFiles": [
16+
"${workspaceFolder}/**/*.js"
17+
]
18+
}
19+
]
20+
}

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"editor.cursorStyle": "line",
3+
"editor.cursorWidth": 4
4+
}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
4949
```shell
5050
cd client
5151
npm run dev'
52-
* Run the server in an existing node project
52+
* Run the server in an existing node project directly without a script
5353
```shell
5454
cd /path/to/target_node_project
55-
npm run dev --prefix /path/to/nopalm
55+
nodemon /path/to/nopalm
5656
```
5757
* Alternatively, alias the nopalm server and run
5858
```shell
@@ -71,7 +71,7 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
7171
<!-- cd to target node project -->
7272
cd /path/to/target_node_project
7373
74-
npm run start --prefix /path/to/nopalm
74+
nodemon /path/to/nopalm
7575
```
7676
* Visit [https://localhost:8001](https://localhost:8001)
7777
* Follow the same steps for testing in `empty directory`
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(() => {
2+
console.log('Hello World! My first Node.js project');
3+
})();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "hello-node-world",
3+
"version": "1.0.0",
4+
"description": "My first node.js project",
5+
"scripts": {
6+
"start": "node ./"
7+
},
8+
"license": "ISC"
9+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "plain-node-app",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"start": "node src/",
6+
"dev": "nodemon app.js"
7+
},
8+
"dependencies": {},
9+
"devDependencies": {
10+
"nodemon": "^3.0.2"
11+
}
12+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const http = require('http');
2+
3+
const server = http.createServer((req, res) => {
4+
if (req.url === '/ping' && req.method === 'GET') {
5+
res.writeHead(200, { 'Content-Type': 'text/plain' });
6+
res.end('Hello World!');
7+
} else {
8+
res.writeHead(404, { 'Content-Type': 'text/plain' });
9+
res.end('Not Found');
10+
}
11+
});
12+
13+
server.listen(4000, () => {
14+
console.log('Server running at http://localhost:4000');
15+
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "plain-node-ts-app",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"start": "ts-node src/",
6+
"dev": "nodemon src/"
7+
},
8+
"dependencies": {},
9+
"devDependencies": {
10+
"typescript": "^5.3.3",
11+
"ts-node": "^10.9.2",
12+
"nodemon": "^3.0.2",
13+
"@types/node": "^20.10.2"
14+
}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import http from 'http';
2+
3+
const server = http.createServer((req, res) => {
4+
if (req.url === '/ping' && req.method === 'GET') {
5+
res.writeHead(200, { 'Content-Type': 'text/plain' });
6+
res.end('Hello World!');
7+
} else {
8+
res.writeHead(404, { 'Content-Type': 'text/plain' });
9+
res.end('Not Found');
10+
}
11+
});
12+
13+
server.listen(4000, () => {
14+
console.log('Server running at http://localhost:4000');
15+
});

0 commit comments

Comments
 (0)