d349fb8328
* Links now get an underline on hover * Cleaned up CSS variable names, added another theme color for more control * Cleaned up unused CSS, removed scrollbars popping up, tons of other little UI tweaks * Renamed shared notes to inbox * Tweaked form display, seperated login and create accouts * Put login/sign up form on home page * Created more legitimate marketing for home page * Tons up updates to note page and note input panel * Better support for two users editing a note * MUCH better diff handling, web sockets restore notes with unsaved diffs * Moved all squire text modifier functions into a mixin class * It now says saving when closing a note * Lots of cleanup and better handiling of events on mount and destroy * Scroll behavior modified to load notes when closer to bottom of page * Pretty decent shared notes and sharable link support * Updated help text * Search now includes tag suggestions and attachment suggestions * Cleaned up scratch pad a ton, allow for users to create new scratch pads * Created a 404 Page and a Shared note page * So many other small improvements. Oh my god, what is wrong with me, not doing commits!?
54 lines
1.1 KiB
JavaScript
54 lines
1.1 KiB
JavaScript
var express = require('express')
|
|
var router = express.Router()
|
|
|
|
let User = require('@models/User');
|
|
const cs = require('@helpers/CryptoString')
|
|
|
|
// middleware that is specific to this router
|
|
router.use(function timeLog (req, res, next) {
|
|
// console.log('Time: ', Date.now())
|
|
next()
|
|
})
|
|
// define the home page route
|
|
router.get('/', function (req, res) {
|
|
res.send('User Home Page ' + User.getUsername())
|
|
})
|
|
// define the about route
|
|
router.get('/about', function (req, res) {
|
|
User.getUsername(req.headers.userId)
|
|
.then( data => res.send(data) )
|
|
})
|
|
// Login User
|
|
router.post('/login', function (req, res) {
|
|
|
|
User.login(req.body.username, req.body.password)
|
|
.then( returnData => {
|
|
|
|
res.send(returnData)
|
|
})
|
|
.catch(e => {
|
|
res.send(false)
|
|
})
|
|
})
|
|
// Login User
|
|
router.post('/register', function (req, res) {
|
|
|
|
User.register(req.body.username, req.body.password)
|
|
.then( returnData => {
|
|
|
|
res.send(returnData)
|
|
})
|
|
.catch(e => {
|
|
res.send(false)
|
|
})
|
|
})
|
|
|
|
|
|
// fetch counts of users notes
|
|
router.post('/totals', function (req, res) {
|
|
User.getCounts(req.headers.userId)
|
|
.then( countsObject => res.send( countsObject ))
|
|
})
|
|
|
|
|
|
module.exports = router |