Skip to content

Instantly share code, notes, and snippets.

@j127
Last active December 19, 2015 07:08
Show Gist options
  • Save j127/5916057 to your computer and use it in GitHub Desktop.
Save j127/5916057 to your computer and use it in GitHub Desktop.
Node.js
// app.js
var express = require('express')
, routes = require('./routes')
, user = require('./routes/user')
, http = require('http')
, path = require('path')
// Include another file
, score = require('./routes/score');
app.get('/', routes.index);
// Use the function from /routes/score.js
app.post('/', score.addScore);
// Then in /routes/score.js, make the function
exports.addScore = function(req, res) {
var score = req.body;
console.log("Received: " + score);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment