Skip to content

Commit 694a89c

Browse files
Complete the project
1 parent 6f89bda commit 694a89c

14 files changed

+3755
-2
lines changed

.gitignore

+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Logs
2+
3+
logs
4+
_.log
5+
npm-debug.log_
6+
yarn-debug.log*
7+
yarn-error.log*
8+
lerna-debug.log*
9+
.pnpm-debug.log*
10+
11+
# Diagnostic reports (https://nodejs.org/api/report.html)
12+
13+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
14+
15+
# Runtime data
16+
17+
pids
18+
_.pid
19+
_.seed
20+
\*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
24+
lib-cov
25+
26+
# Coverage directory used by tools like istanbul
27+
28+
coverage
29+
\*.lcov
30+
31+
# nyc test coverage
32+
33+
.nyc_output
34+
35+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
36+
37+
.grunt
38+
39+
# Bower dependency directory (https://bower.io/)
40+
41+
bower_components
42+
43+
# node-waf configuration
44+
45+
.lock-wscript
46+
47+
# Compiled binary addons (https://nodejs.org/api/addons.html)
48+
49+
build/Release
50+
51+
# Dependency directories
52+
53+
node_modules/
54+
jspm_packages/
55+
56+
# Snowpack dependency directory (https://snowpack.dev/)
57+
58+
web_modules/
59+
60+
# TypeScript cache
61+
62+
\*.tsbuildinfo
63+
64+
# Optional npm cache directory
65+
66+
.npm
67+
68+
# Optional eslint cache
69+
70+
.eslintcache
71+
72+
# Microbundle cache
73+
74+
.rpt2_cache/
75+
.rts2_cache_cjs/
76+
.rts2_cache_es/
77+
.rts2_cache_umd/
78+
79+
# Optional REPL history
80+
81+
.node_repl_history
82+
83+
# Output of 'npm pack'
84+
85+
\*.tgz
86+
87+
# Yarn Integrity file
88+
89+
.yarn-integrity
90+
91+
# dotenv environment variables file
92+
93+
.env
94+
.env.test
95+
.env.production
96+
97+
# parcel-bundler cache (https://parceljs.org/)
98+
99+
.cache
100+
.parcel-cache
101+
102+
# Next.js build output
103+
104+
.next
105+
out
106+
107+
# Nuxt.js build / generate output
108+
109+
.nuxt
110+
dist
111+
112+
# Gatsby files
113+
114+
.cache/
115+
116+
# Comment in the public line in if your project uses Gatsby and not Next.js
117+
118+
# https://nextjs.org/blog/next-9-1#public-directory-support
119+
120+
# public
121+
122+
# vuepress build output
123+
124+
.vuepress/dist
125+
126+
# Serverless directories
127+
128+
.serverless/
129+
130+
# FuseBox cache
131+
132+
.fusebox/
133+
134+
# DynamoDB Local files
135+
136+
.dynamodb/
137+
138+
# TernJS port file
139+
140+
.tern-port
141+
142+
# Stores VSCode versions used for testing VSCode extensions
143+
144+
.vscode-test
145+
146+
# yarn v2
147+
148+
.yarn/cache
149+
.yarn/unplugged
150+
.yarn/build-state.yml
151+
.yarn/install-state.gz
152+
.pnp.\*

README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
# Atari_casino_BE
2-
Atari Casino Backend
1+
# How to run
2+
3+
Follow the following statement to execute backend
4+
5+
1 - git clone "Your repository URL" <br>
6+
2 - npm install<br>
7+
3 - npm run server

api/chats.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
const express = require("express");
2+
const router = express.Router();
3+
4+
// Load User model
5+
const Msg = require("../models/Msg");
6+
7+
// @route POST api/chats/save
8+
// @desc Save message content
9+
// @access Public
10+
router.post("/save", (req, res) => {
11+
const newMsg = new Msg({
12+
user_id: req.body.id,
13+
name: req.body.name,
14+
email: req.body.email,
15+
content: req.body.content,
16+
});
17+
18+
newMsg
19+
.save()
20+
.then(() => {
21+
Msg.find()
22+
.sort({ date: -1 })
23+
.limit(50)
24+
.then((msgs) => {
25+
res.json(msgs);
26+
});
27+
})
28+
.catch((err) => {
29+
return res.status(400).json(err);
30+
});
31+
});
32+
33+
// @route GET api/chats/getdata
34+
// @desc Get all message contents
35+
// @access Public
36+
router.get("/getdata", (req, res) => {
37+
Msg.find()
38+
.sort({ date: -1 })
39+
.limit(50)
40+
.then((msgs) => {
41+
res.json(msgs);
42+
})
43+
.catch((err) => {
44+
return res.status(400).json(err);
45+
});
46+
});
47+
48+
module.exports = router;

0 commit comments

Comments
 (0)