Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Пронин Евгений
/
RfidServerFake
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 611bc9bb
authored
2021-02-22 12:51:54 +0300
by
Пронин Евгений
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
лобавлен запрос getData и cors
1 parent
2cb06e9a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletions
app.js
package-lock.json
package.json
app.js
View file @
611bc9b
// подключение express
// подключение express
const
express
=
require
(
"express"
);
const
express
=
require
(
"express"
);
// создаем объект приложения
// создаем объект приложения
const
cors
=
require
(
'cors'
)
const
app
=
express
();
const
app
=
express
();
// определяем обработчик для маршрута "/"
// определяем обработчик для маршрута "/"
...
@@ -44,7 +45,7 @@ function makeDevice(cards) {
...
@@ -44,7 +45,7 @@ function makeDevice(cards) {
}
}
}
}
app
.
get
(
"/getRfid"
,
(
req
,
res
)
=>
{
app
.
get
(
"/getRfid"
,
cors
(),
(
req
,
res
)
=>
{
var
msg
=
JSON
.
stringify
(
state
,
null
,
'\t'
);
var
msg
=
JSON
.
stringify
(
state
,
null
,
'\t'
);
if
(
req
.
query
.
callback
!==
undefined
)
{
if
(
req
.
query
.
callback
!==
undefined
)
{
msg
=
req
.
query
.
callback
+
"("
+
msg
+
");"
;
msg
=
req
.
query
.
callback
+
"("
+
msg
+
");"
;
...
@@ -54,6 +55,22 @@ app.get("/getRfid", (req, res) => {
...
@@ -54,6 +55,22 @@ app.get("/getRfid", (req, res) => {
});
});
app
.
get
(
"/getData"
,
(
req
,
res
)
=>
{
let
terminal_sn
=
state
.
terminal_sn
;
let
data
=
{
"pult_sn"
:
terminal_sn
,
"serv_ip"
:
"unknown"
,
"serv_port"
:
"unknown"
};
var
msg
=
JSON
.
stringify
(
data
,
null
,
'\t'
);
if
(
req
.
query
.
callback
!==
undefined
)
{
msg
=
req
.
query
.
callback
+
"("
+
msg
+
");"
;
return
res
.
type
(
'application/javascript'
).
send
(
msg
);
}
res
.
type
(
'application/json'
).
send
(
msg
);
});
// положить карту
// положить карту
app
.
get
(
"/"
,
(
req
,
res
)
=>
{
app
.
get
(
"/"
,
(
req
,
res
)
=>
{
res
.
status
(
200
).
send
(
`<ul>
res
.
status
(
200
).
send
(
`<ul>
...
...
package-lock.json
View file @
611bc9b
...
@@ -232,6 +232,15 @@
...
@@ -232,6 +232,15 @@
"resolved"
:
"https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz"
,
"resolved"
:
"https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz"
,
"integrity"
:
"sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
"integrity"
:
"sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
},
},
"cors"
:
{
"version"
:
"2.8.5"
,
"resolved"
:
"https://registry.npmjs.org/cors/-/cors-2.8.5.tgz"
,
"integrity"
:
"sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g=="
,
"requires"
:
{
"object-assign"
:
"^4"
,
"vary"
:
"^1"
}
},
"create-error-class"
:
{
"create-error-class"
:
{
"version"
:
"3.0.2"
,
"version"
:
"3.0.2"
,
"resolved"
:
"https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz"
,
"resolved"
:
"https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz"
,
...
@@ -774,6 +783,11 @@
...
@@ -774,6 +783,11 @@
"path-key"
:
"^2.0.0"
"path-key"
:
"^2.0.0"
}
}
},
},
"object-assign"
:
{
"version"
:
"4.1.1"
,
"resolved"
:
"https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz"
,
"integrity"
:
"sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"on-finished"
:
{
"on-finished"
:
{
"version"
:
"2.3.0"
,
"version"
:
"2.3.0"
,
"resolved"
:
"https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz"
,
"resolved"
:
"https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz"
,
...
...
package.json
View file @
611bc9b
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
"dev"
:
"nodemon ./app"
"dev"
:
"nodemon ./app"
},
},
"dependencies"
:
{
"dependencies"
:
{
"cors"
:
"^2.8.5"
,
"express"
:
"~4.16.4"
"express"
:
"~4.16.4"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment