Search the Community

Showing results for tags 'express'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 9 results

  1. I'm using express.js to serve a BabylonJS app statically. The dev server is ts-node running on localhost. Everything is going great except that it won't load .env files. If I try loading the .env file: const envTexture = BABYLON.CubeTexture.CreateFromPrefilteredData("assets/textures/mono_lake.env", scene); const skyBox = scene.createDefaultSkybox(envTexture, true, 128); I get the error "Cannot load cubemap because files were not defined" in the console. Elsewhere on the forum, I see that people using IIS servers need to explicitly allow .env file mimetypes in a web.config file, but I'm wondering if this is necessary in express running on locahost? What makes me think it is not a mime issue, is that I do seem to be able to load the .env as a binary file if I use the code below: Someone must be serving Babylon files over node, does anyone know how to get this working? const assetManager = new BABYLON.AssetsManager(scene); const skyboxTask = assetManager.addBinaryFileTask("skybox", "assets/textures/mono_lake.env"); skyboxTask.onError = (task, message, exception) => { console.log(message); } skyboxTask.onSuccess = task => { console.log("success, length: ",;// returns the correct length of the .env file } assetManager.load();
  2. i using nodejs ,mysql ,express i trying put two methods in same route to render the same file but i have this error in my firefox 404 my code aliança route const express = require('express') const router = express.Router() const connection = require('../../Config/database') const controllerAdmin = require('../../controllers/Administration') const controlleruser = require('../../controllers/Alliances') router.get('/Administration/Alliances', (req, res) => controllerAdmin.findcidade3(connection, req, res)); router.get('/Administration/Alliances', (req, res) => controlleruser.findAlianca(connection, req, res)); module.exports = app => app.use('/', router) aliança controller const Allianca = require('../models/Alliances') const findAlianca = async (connection, req, res) => { const allianca = await Allianca.find(connection,req.session.user.username) if (!allianca) { res.status(404).send('Nenhuma cidade encontrada.') return; } console.log("dddd"); req.session.alianca = allianca res.locals.alianca = allianca res.render('Administration/Alliances') } module.exports = { findAlianca } aliança models const find = (connection,username) => { return new Promise((resolve, reject) => { connection.query(`SELECT alianca.nome,alianca.N_membros,alianca.TAG FROM user INNER JOIN alianca ON WHERE user.username='${username}'`, (err, result) => { if(err){ reject(err) }else{ console.log(result[0]); resolve(result[0]) } }) }) } module.exports = { find } na app tenho o seguinte require('./routes/Administration/Alliances')(app) aliança.jade tenho assim extends layout block title .col-xs-6.col-xs-offset-3.col-sm-6.col-sm-offset-3 .col-sm-4(style='width:76%') div.panel.panel-primary(style='height:50px') Alliances Page div.panel.panel-primary(style='height:700px') fdssdklfsdklfjskldfjkldsjfl if locals.user.cod_alianca==null p You Dont Have Alliances else br span Your Aliance span= locals.alianca.nome .col-xs-2.panel-red(style='width:24%;height:100%;text-align:center') coneção com base dados tenho o seguinte const mysql = require('mysql') const config = require( "./config.json" ) const connection =mysql.createConnection({, user:config.user, password:config.password, database:config.database, // port:config.port }); connection.connect((err) =>{ if(err){ console.log(err) process.exit(0) }else{ console.log('database on') } }) connection.query(`CREATE TABLE IF NOT EXISTS user (userId INT(11) NOT NULL AUTO_INCREMENT, username VARCHAR(50) DEFAULT NULL, password VARCHAR(60) DEFAULT NULL, PRIMARY KEY (userId))`, (err ,result) =>{ if(err){ console.log(err) } }) module.exports = connection and cmd have this errors GET /Administration/Alliances 500 217.138 ms - 7876 GET /Administration/vendor/bootstrap/css/bootstrap.min.css 404 42.201 ms - 7876 GET /Administration/vendor/fontawesome/css/font-awesome.min.css 404 80.007 ms - 7876 GET /Administration/vendor/themify-icons/themify-icons.min.css 404 112.356 ms - 7876 GET /Administration/vendor/animate.css/animate.min.css 404 142.545 ms - 7876 GET /Administration/vendor/perfect-scrollbar/perfect-scrollbar.min.css 404 176.203 ms - 7876 GET /Administration/vendor/switchery/switchery.min.css 404 208.608 ms - 7876 GET /Administration/stylesheets/plugins.css 404 35.953 ms - 7876 GET /Administration/stylesheets/styles.css 404 64.049 ms - 7876 what i doing wrong
  3. Hi, I have a nodjs application that is currently saved in Windows 2012 R2 server using IISnode with IIS 8.5. I am getting a 404 File or directory not found error, however nothing is being recorded in the error logs. When I run this locally I have no issues and the game runs well. Thinking it could be a permissions issue, I decided to provide temporary read/write access, however that didn't seem to make a difference. I also confirmed that the links are all correct in terms of where files are sitting. Here is my server side code: var PORT = process.env.PORT || 8080; var express = require('express'); var app = express(); var http = require('http'); var path = require('path'); var util = require("util"); var server = require('http').createServer(app); var compression = require('compression'); //Get required classes xyLocation = require("./xyLocation").xyLocation; app.use(compression()); //Compress all routes app.use('/client', express.static(__dirname + '/client')); app.use('/js', express.static(__dirname + '/js')); app.use('/css', express.static(__dirname + '/css')); app.use('/sounds', express.static(__dirname + '/sounds')); app.use('/images', express.static(__dirname + '/images')); // Routing app.get('/', function(request, response) { response.sendFile(path.join(__dirname, 'index.html')); }); server.listen(PORT); console.log('Starting server on port '+ PORT); var io = require('')(server,{}); io.sockets.on('connection', function(socket) { ... Thanks MLA
  4. How do you configure the server for this template ? => I'm trying to do it by following this tutorial => I added two dependencies: nodemon and express. I created the server.js file with the server configuration. const express = require('express') const app = express() const server = require('http').Server(app) const path = require('path') app.get('/', function(req, res) { res.sendFile(path.resolve('index.html')) }) server.listen(8081, function() { console.log(`Listening on ${server.address().port}`) }) In the package.json file, I added a command to start the server: nodemon src/server/server.js The server starts correctly but the indicated html file can not read the scripts (" The load failed for the "script" element with the source vendor.js and app.js"). Project structure:
  5. Hi, I'm creating a node js game, using javascript and socket io. I originally was not going to add a mongo DB, but now I'm thinking I should for anyone who may accidentally be disconnected from the game. What would the best game option be? To use a database or not, and the reasons behind it. Many thanks, MLA
  6. It seems that to send a private message to a player, you are supposed to use I need to emit an image to a specific player so am using this concept, however it doesn't seem to work. Would anyone know how to emit an image to a specific client? Thanks!
  7. Hi, I have been struggling with a minor issue, that I'm hoping someone can help me out with. I have a multiplayer game that uses Express and Socket io. When a new player logs into the game, the player walks to a certain location on screen. In order to make the player walk, I am drawing the player to canvas using a spirit map. In order to make the player walk per frame I am using the ctx.clearRect() to clear the previous frame, however doing this naturally clears the full canvas and removes the already logged player. I'm not sure how to work around this. Any insight is greatly appreciated. Thanks, Laura server.js Player.js
  8. Hello All, I am working on a multiplayer action role playing game and I am using Phaser on the client because I just love this framework. Here is a link to the project on GitHub: I have been experimenting quite a lot with running Phaser in headless mode on the server and I managed to get it to run with a few hacks. I am not sure that it is a good idea to run Phaser on the server, but I am looking into this because I would prefer to have an authoritative server that runs on the same code base as my clients. Here is what I did in order to get Phaser running on the server: First I installed the latest stable version of Phaser through NPM by running the following command: npm install that I installed the dependencies for Node Canvas, instructions for that can be found in the project wiki on GitHub: Next I installed node-canvas and jsdom through NPM. These modules are required in order to "fake" the document, window, canvas and image objects that Phaser depends on that all are available in all browsers, but not on Node.js. npm install jsdomnpm install node-canvasThen I wrote this wrapped module for Phaser: I know that this is a ugly hack, but it at least lets me run Phaser on the server. Here is what the server currently outputs: I am now wondering if I should attempt to make changes to Phaser itself to not rely on the document, window, canvas, image when running in headless mode and create a pull-request for the changes. I am sure it will not be easy to remove all those dependencies, if even possible. Does anyone know if Richard has any plans for this? Does this even make sense to run Phaser on the server? Please share your ideas and feel free to use my code for your own projects. Thank you for reading.
  9. primrose93

    Node.js Multiplayer Simple Game Here's a sharable link to the directory where my files are located. There's no node_modules, so it's necessary to install before express and The problem is I can't create and render the balls which need to bounce all the time. The server is responsible for creating my players and balls. I did successfully the creation and movement of my players with the arrow keys and that's synchronised to all the clients. But I can't do the part with bouncing balls. It seems simple game but as far as I am new to this stuff, I can't figure it out. I provide a link to the directory of my files. The command to start the game is: node server.js. If anyone could help me, I would be very happy. Thanks in advance guys.