UNPKG

nino-github-example

Version:

Get a list of github user repos

47 lines (37 loc) 1.25 kB
// Myble Chat Networks // Author: Nino Merdzanovic var fs = require('fs'); // File Sync var config = JSON.parse(fs.readFileSync("config.json")); // Loading the JSON file var host = config.host; // Chat Host var port = config.port; // Chat Port connecting var express = require('express'); // Load module "Express" var MybleChat = express(); MybleChat.use(express.static(__dirname + "/")); // Set to ROOT folder MybleChat.get("/", function(request, response) { response.send("Welcome to the myble chat networks"); }); // Admin & Moderator users var moderators = { "1": { "nickname": "Galanthus", "password": "hihahoe", "role": "Admin" }, "2": { "nickname": "Albinity", "password": "aleboy", "role": "Moderator" } }; // Show List of Admins MybleChat.get("/moderator/:id", function(request, response) { var user = moderators[request.params.id]; if(user) { response.send("Nickname: " + user.nickname + "<br />" + user.password + "<br />" + user.role); } else { response.send("Sorry, this username doesnt excist."); } }); // Lets Run this baby MybleChat.listen(port, host); console.log("Chat running on: " + config.host + ":" + config.port);