Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 19c1204

Browse filesBrowse files
committed
Init project
1 parent c990a4c commit 19c1204
Copy full SHA for 19c1204

File tree

5 files changed

+1723
-1
lines changed
Filter options

5 files changed

+1723
-1
lines changed

‎README.md

Copy file name to clipboard
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
# nodejs-backend
1+
# nodejs-backend
2+
3+
Исходный код по теме "Как запустить бэкэнд на Node JS"
4+
5+
https://it-dev-journal.ru/articles/kak-zapustit-bekend-na-node-js

‎my-app/index.js

Copy file name to clipboard
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const express = require('express');
2+
3+
const PORT = process.env.PORT || 3010;
4+
const app = express();
5+
6+
app.use((req, res, next) => {
7+
res.setHeader('Access-Control-Allow-Origin', '*');
8+
next();
9+
});
10+
11+
const todoItems = require('./todo-items.json');
12+
app.get('/api/todo-items', (req, res) => {
13+
res.json({ data: todoItems });
14+
});
15+
16+
app.listen(PORT, () => {
17+
console.log(`Server listening on ${PORT}`);
18+
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.