start_game
вынесу goUser "address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
$.getJSON('http://localhost:5000/api/users', function(data) {
data = JSON.parse(data);
for(var i=0; i<data.users.length; i++){
$('tbody').append(
'<tr><td>' + data.users[i].id +
'</td><td>' + data.users[i].name +
'</td><td>' + data.users[i].username +
'</td><td>' + data.users[i].email +
'</td><td>' + data.users[i].phone +
'</td><td>' + data.users[i].website + '</td><tr>');
}
});
$.getJSON('http://localhost:5000/api/users', function(data) {
for(var i=0; i<data.length; i++){
$('tbody').append(
'<tr><td>' + data.id +
'</td><td>' + data.name +
'</td><td>' + data.username +
'</td><td>' + data.email +
'</td><td>' + data.phone +
'</td><td>' + data.website + '</td><tr>');
}
});
const express = require('express');
const jsonServer = require('json-server');
const path = require("path");
const app = express();
app.get('/', function (req, res) {
res.sendFile(path.join(__dirname + '/public/index.html'));
});
app.use(express.static(path.join(__dirname, 'public')));
app.use('/api', jsonServer.router('./db/users.json'));
app.listen(5000);
{
"name": "task",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "./node_modules/.bin/nodemon server.js localhost 5000"
},
"author": "GEOS",
"license": "ISC",
"dependencies": {
"express": "^4.16.2",
"json-server": "^0.12.1"
},
"devDependencies": {
"nodemon": "^1.14.3"
}
}