This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl https://api.mover.io/connectors \ | |
-H "Authorization: MoverAPI app_id=2tsc0f9n9l4v209oara0mb2j5ur9my8v app_secret=65oow347p1q7d0loj45oje2u3sol99xd" \ | |
-X GET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
express = require 'express' | |
app = express(); | |
# Configure | |
require('./config')(app) | |
# Routes | |
require('./routes')(app) | |
module.exports = app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
request = require 'supertest' | |
scope = require 'nock' | |
app = require process.cwd() + '/app.coffee' | |
backend = require process.cwd() + 'lib/backend.coffee' | |
URL = | |
describe 'Collections', -> | |
describe 'show', -> | |
it "should return a 404 if the object doesn't exist", (done) -> | |
scope = nock(backend.url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
request = require 'supertest' | |
app = require process.cwd() + '/app.coffee' | |
describe 'Connectors', -> | |
describe 'create', -> | |
it "should return a 400 error if there is no type specified", (done) -> | |
request(app) | |
.post("/connectors") | |
.set( 'Authorization', "MoverApi app_id=embiggen app_secret=cromulent" ) | |
.send( {} ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http = require 'http' | |
app = require './app' | |
http.createServer(app).listen app.get('port'), -> | |
console.log "Express server listening on port " + app.get('port') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
express = require 'express' | |
app = express(); | |
# Configure | |
require('./config')(app) | |
# Routes | |
require('./routes')(app) | |
module.exports = app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Example = require './controllers/example' | |
router = (app) -> | |
# Examples | |
app.get '/example/:id', Example.show | |
app.delete '/example/:id', Example.del | |
app.get '/example', Example.index | |
app.post '/example', Example.create | |
module.exports = router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
express = require 'express' | |
config = (app) -> | |
# Configuration | |
app.set 'port', process.env.PORT || 3000 | |
app.use express.favicon() | |
app.use express.methodOverride() # Allows the use of HTTP 'DELETE' AND 'PUT' methods. | |
app.use express.logger() | |
app.use app.router | |
app.use express.errorHandler() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "Google", -> | |
describe "stuff", -> | |
it "should return success", (done) -> | |
options = | |
host: "www.google.com" | |
method: "GET" | |
google = http.request options, (res) -> | |
res.should.have.status 200 | |
done() | |
google.end() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "Calculator", -> | |
describe "addition", -> | |
it "should add two numbers", -> | |
add(2, 2).should.equal 4 |