old concepts

This commit is contained in:
Mateusz Pstrucha committed 2021-05-24 20:43:45 +02:00
commit 06b57a9ded
3 files changed
+83

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
const dotenv = require('dotenv').config(),
express = require('express'),
path = require('path'),
// cookieParser = require('cookie-parser'),
http = require('http'),
// https = require('https'),
fs = require('fs'),
pretty = require('pretty-log'),
io = require('socket.io'),
// crypto = require('crypto'),
// SpotifyWebApi = require('spotify-web-api-node'),
// db = require('./db');
var app = express(),
www = http.createServer(app),
server = io(www);
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.set('port', process.env.port);
www.listen(process.env.port);
www.on('error', function (error) {
if (error.syscall !== 'listen') {
throw error;
}
pretty.log({
data: `Error: port ${process.env.port}: ${error.code}`,
action: 'error'
})
});
www.on('listening', function () {
pretty.log(`www: listening on ${process.env.port}`)
});
server.on('connection', socket => {
} )
+29
View File
@@ -0,0 +1,29 @@
// app.get('/login', function (req, res) {
// var scopes = ['user-read-private', 'user-read-email'],
// redirect = spotify.createAuthorizeURL(scopes, 'what')
// res.redirect(redirect)
// // res.redirect('https://accounts.spotify.com/authorize' +
// // '?response_type=code' +
// // '&client_id=' + credentials.spotify.clientId +
// // (scopes ? '&scope=' + encodeURIComponent(scopes) : '') +
// // '&redirect_uri=' + encodeURIComponent('https://radio-rolnik.mtps.pl/logedin'));
// });
// app.get('/logedin', function (req, res) {
// console.log(req.query.code)
// spotify.authorizationCodeGrant(req.query.code).then(
// function (data) {
// console.log('The token expires in ' + data.body['expires_in']);
// console.log('The access token is ' + data.body['access_token']);
// console.log('The refresh token is ' + data.body['refresh_token']);
// // Set the access token on the API object to use it in later calls
// spotify.setAccessToken(data.body['access_token']);
// spotify.setRefreshToken(data.body['refresh_token']);
// },
// function (err) {
// console.log('Something went wrong!', err);
// }
// );
// })
+11
View File
@@ -0,0 +1,11 @@
{
"name": "radio-rolnik-player",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Mateusz Pstrucha",
"license": "ISC"
}