I need to get back into using git. The hell is wrong with me!?

This commit is contained in:
Max G committed 2019-12-20 05:50:50 +00:00
1 parent 7b77bd37f3
commit 6fe39406b7
135 files changed
+53273 -699

No files matched your search

+22 -7
View File
@@ -8,19 +8,19 @@ const app = express()
const port = 3000
//Enable json body parsing in requests. Allows me to post data in ajax calls
app.use(express.json())
app.use(express.json({limit: '2mb'}))
//Prefix defied by route in nginx config
const prefix = '/api'
//App Auth, all requests will come in with a token, decode the token and set global var
app.use(function(req, res, next){
let token = req.headers.authorization
//auth token set by axios in headers
let token = req.headers.authorizationtoken
if(token && token != null && typeof token === 'string'){
Auth.decodeToken(token)
.then(userData => {
req.headers.userId = userData.id //Update headers for the rest of the application
next()
}).catch(error => {
@@ -36,17 +36,32 @@ app.use(function(req, res, next){
//Test
app.get(prefix, (req, res) => res.send('The api is running'))
//Init user endpoint
//Serve up uploaded files
app.use(prefix+'/static', express.static( __dirname+'/../staticFiles' ))
//Public routes
var public = require('@routes/publicController')
app.use(prefix+'/public', public)
//user endpoint
var user = require('@routes/userController')
app.use(prefix+'/user', user)
//Init notes endpoint
//notes endpoint
var notes = require('@routes/noteController')
app.use(prefix+'/note', notes)
//Init tags endpoint
//tags endpoint
var tags = require('@routes/tagController')
app.use(prefix+'/tag', tags)
//notes endpoint
var attachment = require('@routes/attachmentController')
app.use(prefix+'/attachment', attachment)
//quick notes endpoint
var quickNote = require('@routes/quicknoteController')
app.use(prefix+'/quick-note', quickNote)
//Output running status
app.listen(port, () => console.log(`Listening on port ${port}!`))