p5.js-web-editor/server/routes/server.routes.js
Cassie Tarakajian e140702784 Create Asset List View and refactor overlay code (#356)
* start to create asset list

* begin refactoring overlay component to remove duplicate code

* refactoring of overlays, asset list styles

* changes to add size to asset list

* fixes to asset list

* handle case in which a user hasn't uploaded any assets

* fix bug in which asset list only grabbed first asset

* remove console.log

* update overlay exit styling to use icon mixin
2017-07-11 17:37:43 +02:00

73 lines
1.8 KiB
JavaScript

import { Router } from 'express';
import { renderIndex } from '../views/index';
import { get404Sketch } from '../views/404Page';
import { userExists } from '../controllers/user.controller';
const router = new Router();
// this is intended to be a temporary file
// until i figure out isomorphic rendering
router.route('/').get((req, res) => {
res.send(renderIndex());
});
router.route('/signup').get((req, res) => {
res.send(renderIndex());
});
router.route('/projects/:project_id').get((req, res) => {
res.send(renderIndex());
});
router.route('/:username/sketches/:project_id').get((req, res) => {
res.send(renderIndex());
});
// router.route('/full/:project_id').get((req, res) => {
// res.send(renderIndex());
// });
router.route('/login').get((req, res) => {
res.send(renderIndex());
});
router.route('/reset-password').get((req, res) => {
res.send(renderIndex());
});
router.route('/reset-password/:reset_password_token').get((req, res) => {
res.send(renderIndex());
});
router.route('/verify').get((req, res) => {
res.send(renderIndex());
});
router.route('/sketches').get((req, res) => {
res.send(renderIndex());
});
router.route('/about').get((req, res) => {
res.send(renderIndex());
});
router.route('/:username/sketches').get((req, res) => {
userExists(req.params.username, exists => (
exists ? res.send(renderIndex()) : get404Sketch(html => res.send(html))
));
});
router.route('/:username/assets').get((req, res) => {
userExists(req.params.username, exists => (
exists ? res.send(renderIndex()) : get404Sketch(html => res.send(html))
));
});
router.route('/:username/account').get((req, res) => {
userExists(req.params.username, exists => (
exists ? res.send(renderIndex()) : get404Sketch(html => res.send(html))
));
});
export default router;