2016-06-23 22:29:55 +00:00
|
|
|
import { Router } from 'express';
|
2016-11-17 16:15:35 +00:00
|
|
|
import { renderIndex } from '../views/index';
|
2017-01-06 20:05:02 +00:00
|
|
|
import { get404Sketch } from '../views/404Page';
|
2017-02-22 19:29:35 +00:00
|
|
|
import { userExists } from '../controllers/user.controller';
|
|
|
|
|
|
|
|
const router = new Router();
|
2016-06-18 22:33:49 +00:00
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
// this is intended to be a temporary file
|
2016-06-18 22:33:49 +00:00
|
|
|
// until i figure out isomorphic rendering
|
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
router.route('/').get((req, res) => {
|
2016-11-08 23:11:12 +00:00
|
|
|
res.send(renderIndex());
|
2016-06-18 22:33:49 +00:00
|
|
|
});
|
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
router.route('/signup').get((req, res) => {
|
2016-11-08 23:11:12 +00:00
|
|
|
res.send(renderIndex());
|
2016-06-18 22:33:49 +00:00
|
|
|
});
|
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
router.route('/projects/:project_id').get((req, res) => {
|
2016-11-08 23:11:12 +00:00
|
|
|
res.send(renderIndex());
|
2016-06-18 22:33:49 +00:00
|
|
|
});
|
|
|
|
|
2016-12-01 22:12:34 +00:00
|
|
|
router.route('/:username/sketches/:project_id').get((req, res) => {
|
|
|
|
res.send(renderIndex());
|
|
|
|
});
|
|
|
|
|
2016-11-02 15:12:07 +00:00
|
|
|
// router.route('/full/:project_id').get((req, res) => {
|
2016-11-08 23:11:12 +00:00
|
|
|
// res.send(renderIndex());
|
2016-11-02 15:12:07 +00:00
|
|
|
// });
|
2016-08-17 22:13:17 +00:00
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
router.route('/login').get((req, res) => {
|
2016-11-08 23:11:12 +00:00
|
|
|
res.send(renderIndex());
|
2016-06-18 22:33:49 +00:00
|
|
|
});
|
|
|
|
|
2016-10-12 16:02:46 +00:00
|
|
|
router.route('/reset-password').get((req, res) => {
|
2016-11-08 23:11:12 +00:00
|
|
|
res.send(renderIndex());
|
2016-10-12 16:02:46 +00:00
|
|
|
});
|
|
|
|
|
2016-10-18 20:07:25 +00:00
|
|
|
router.route('/reset-password/:reset_password_token').get((req, res) => {
|
2016-11-08 23:11:12 +00:00
|
|
|
res.send(renderIndex());
|
2016-10-18 20:07:25 +00:00
|
|
|
});
|
|
|
|
|
2016-07-05 20:04:14 +00:00
|
|
|
router.route('/sketches').get((req, res) => {
|
2016-11-08 23:11:12 +00:00
|
|
|
res.send(renderIndex());
|
2016-07-05 20:04:14 +00:00
|
|
|
});
|
|
|
|
|
2016-08-22 16:35:59 +00:00
|
|
|
router.route('/about').get((req, res) => {
|
2016-11-08 23:11:12 +00:00
|
|
|
res.send(renderIndex());
|
2016-08-22 16:35:59 +00:00
|
|
|
});
|
|
|
|
|
2016-08-17 19:53:25 +00:00
|
|
|
router.route('/:username/sketches').get((req, res) => {
|
2017-02-22 19:29:35 +00:00
|
|
|
userExists(req.params.username, exists => (
|
2017-01-06 18:08:03 +00:00
|
|
|
exists ? res.send(renderIndex()) : get404Sketch(html => res.send(html))
|
|
|
|
));
|
2016-08-17 19:53:25 +00:00
|
|
|
});
|
|
|
|
|
2017-03-30 16:36:26 +00:00
|
|
|
router.route('/:username/account').get((req, res) => {
|
|
|
|
userExists(req.params.username, exists => (
|
|
|
|
exists ? res.send(renderIndex()) : get404Sketch(html => res.send(html))
|
|
|
|
));
|
|
|
|
});
|
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
export default router;
|