myClients = [];
wss.on('connection', function(ws) {
myClients.push(ws);
});
router.get('/', controller.getArrSelectDataType);
router.post('/', controller.getArrSelectTicker);
router.post('/', controller.getArrSelectSource);
router.get('/get-arr-select-data-type', controller.getArrSelectDataType);
router.post('/get-arr-select-data-ticker', controller.getArrSelectTicker);
router.post('/get-arr-select-data-source', controller.getArrSelectSource);
router.get('/test', (req, res) => {
res.send('Даные, которые возвращаем обратно на клиент');
})
@BelongsTo(() => User)
user: User;
@ForeignKey(() => User)
@Column({
type: DataType.STRING,
allowNull: false,
})
userId: string;
@HasMany(() => Goods)
userGoods: Goods[];
FROM node:12-alpine
WORKDIR /app
COPY . .
RUN npm install
CMD ["npm", "start"]
module.exports = {
apps: [
{
name: 'API',
script: './bin/www',
instances: 1,
autorestart: true,
exec_mode: 'cluster',
max_memory_restart: '1G',
},
],
};
function asd() {
const p = new Promise ((resolve, reject) => {
socket.on('событие', data => {
resolve(data);
});
});
return p;
}
asd()
.then(result => console.log(result))
function asd() {
const p = new Promise ((resolve, reject) => {
socket.on('событие', data => {
resolve(data);
});
});
return p;
}
(async () => {
const result = await asd();
console.log(result);
})()