Skip to content

Instantly share code, notes, and snippets.

@forsythetony
Created June 6, 2015 18:39
Show Gist options
  • Save forsythetony/9360b5d7b98d94bcf740 to your computer and use it in GitHub Desktop.
Save forsythetony/9360b5d7b98d94bcf740 to your computer and use it in GitHub Desktop.
var express = require('express'),
user = require('./routes/users'),
story = require('./routes/story'),
photos = require('./routes/photos'),
sms = require('./routes/sms'),
manager = require('./routes/manager');
var app = express();
app.configure(function () {
app.use(express.logger('dev'));
app.use(express.bodyParser());
});
// For users
app.get( '/users' , user.findAll );
app.get( '/users/:id' , user.findById );
app.post( '/users' , user.addUser );
app.put( '/users/:id' , user.updateUser );
app.delete( '/users/:id' , user.deleteUser );
// For stories
app.post( '/stories' , story.addStory );
app.get( '/stories' , story.findAll );
app.get( '/stories/:id' , story.findById );
// For photographs
app.post( '/photos' , photos.addPhotoWithURL );
app.post( '/photos/:id' , photos.addInformationToPhoto );
app.get( '/photos' , photos.findAll );
app.get( '/photos/:id' , photos.findById );
app.delete( '/photos/:id' , photos.deletePhoto);
app.put('/photos/:id', photos.updatePhoto);
// For managing things
app.get( '/manager' , manager.listingTest );
// SMS Testing
app.get( '/sms' , sms.showTopics );
app.listen(3000);
console.log('Listening on port 3000...');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment