Skip to content

Commit

Permalink
move api to routes folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Alwyn committed Oct 25, 2016
1 parent ee21fc4 commit d7ca112
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Jason Miller
Copyright (c) 2016 Kyle Alwyn

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
2 changes: 1 addition & 1 deletion app/config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function () {
// Logger
app.use(morgan('dev'));

// Add more routes to HTTP
// Add all HTTP methods
app.use(methodOverride());

// Decode JSON
Expand Down
8 changes: 3 additions & 5 deletions app/config/passport/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';
import localStrategy from './local';

module.exports = () => {
require('./local')();
export {
localStrategy
}


File renamed without changes.
File renamed without changes.
8 changes: 3 additions & 5 deletions app/api/posts.js → app/routes/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import { isAuthenticated } from '../lib/auth';
import { respond } from '../lib/util';
import Post from '../models/post';


// BASE: /posts

let router = Router();
const router = new Router();

/**
* Get All Posts
Expand All @@ -23,11 +21,11 @@ let router = Router();
* Create Post
*/
router.post('/', isAuthenticated(), (req, res, next) => {
let post = new Post(req.body);
const post = new Post(req.body);
post._user = req.currentUser.id;
post.save(respond(res, 201));
});



export default router;
export default router;
File renamed without changes.

0 comments on commit d7ca112

Please sign in to comment.