sbkwgh 5 år sedan
förälder
incheckning
3b5e73564f
5 ändrade filer med 5 tillägg och 169 borttagningar
  1. 0 157
      DOCUMENTATION.md
  2. 1 1
      README.md
  3. 1 9
      frontend/src/main.js
  4. 2 1
      frontend/vue.config.js
  5. 1 1
      server.js

+ 0 - 157
DOCUMENTATION.md

@@ -1,157 +0,0 @@
-# API Documentation
-
-All API routes are prefixed `/api/v1/`
-
-## /admin_token
-All sub-routes require admin privileges
-
-### /
-* Method: `POST`
-* Response:
-  ```
-    {
-        id: <integer>,
-        token: <string>
-    }
-  ```
-
-## /ban
-All sub-routes require admin privileges
-
-### /
-* Method: `POST`
-* Data params:
-  * `message <string>`
-  * `username <string>`
-  * `canCreateThreads <boolean>`
-  * `canCreatePosts <boolean>`
-  * `ipBanned <boolean>`
-* Response:
-  ```
-  {
-      id: <integer>,
-      message: <string>,
-      canCreateThreads: <boolean>,
-      canCreatePosts: <boolean>,
-      ipBanned: <boolean>,
-      User: {
-          id: <integer>,
-          username: <string>,
-          description: <null | string>,
-          color: <string>,
-          createdAt: <string>
-      }
-  ```
-
-### /
- * Method: `GET`
- * Response:
-   ```
-   [{
-       id: <integer>,
-       createdAt: <string>,
-       updatedAt: <string>,
-       canCreatePosts: <boolean>,
-       canCreateThreads: <boolean>,
-       ipBanned: <boolean>,
-       message: <string>,
-       UserId: <integer>
-   }, ...]
-   ```
-   
-### /:id
- * Method: `DELETE`
- * URL params: `id <integer>`
- * Response:
-   ```
-   { success: true }
-   ```
-
-## /category
-
-### /
- * Method: `GET`
- * Reponse:
-   ```
-   [{
-       color: <string>,
-       createdAt: <string>,
-       id: <integer>,
-       name: <string>,
-       updatedAt: <string>,
-       value: <string>
-   }, ...]
-   ```
-
-### /:category
- * Method: `GET`
- * URL params: `category <string>`
- * Query params:
-   * `username <string, optional>`
-   * `from <integer, optional>`
-   * `limit <integer, optional>`
-* Response:
-  ```
-  {
-      name: <string>,
-      value: <string>,
-      color: <string>,
-      [id: <integer>],
-      [createdAt: <string>],
-      [updatedAt: <string>],
-      Threads: [ ... ],
-      meta: {
-         nextURL: <string | null>,
-         nextThreadsCount: <integer>
-      }
-  }
-  ```
-  
-### /
-* Method: `POST`
-* Data params:
-  * `name <string>`
-  * `color <string, optional>`
-* Response:
-  ```
-  {
-      color: <string>,
-      createdAt: <string>,
-      id: <integer>,
-      name: <string>,
-      updatedAt: <string>,
-      value: <string>
-  }
-  ```
-* Notes: requires admin privileges
-
-### /:id
-* Method: `PUT`
-* URL params: `id <integer>`	
-* Data params:
-  * `name <string, optional>`
-  * `color <string, optional>`
-* Response:
-  ```
-  {
-      color: <string>,
-      createdAt: <string>,
-      id: <integer>,
-      name: <string>,
-      updatedAt: <string>,
-      value: <string>
-  }
-  ```
-* Notes: requires admin privileges
-
-### /
-* Method: `DELETE`
-* URL params: `id <integer>`
-* Response:
-  ```
-  {
-      success: true,
-      otherCategoryCreated: <category object | null>
-  }
-  ```
-* Notes: requires admin privileges

+ 1 - 1
README.md

@@ -48,7 +48,7 @@ To install on Heroku:
  6. Add database add-on, get database URL
  7. `heroku config:set DATABASE_URL=<database-url>`
  8. `cd frontend && npm install`
- 9. `npm run build`
+ 9. `npx vue-cli-service build`
  10. Remove the line `dist/` from `.gitignore`
  11. `cd .. && git add -A && git commit -m "Update .gitignore"`
  12. `git push heroku master`

+ 1 - 9
frontend/src/main.js

@@ -79,18 +79,10 @@ Vue.use(linkExpander)
 
 Vue.use({
 	install (Vue) {
-		Vue.prototype.$socket = io('http://localhost:8080')
+		Vue.prototype.$socket = $socket;
 	}
 })
 
-/* Vue.$socket.on('disconnect', () => {
-	Vue.$socket.connect('http://localhost:3000', {
-		reconnection: true,
-		reconnectionDelay: 1000,
-		reconnectionDelayMax : 5000,
-		reconnectionAttempts: Infinity
-	} );
-}) */
 
 const router = new VueRouter({
 	routes: [

+ 2 - 1
frontend/vue.config.js

@@ -1,5 +1,6 @@
 module.exports = {
 	devServer: {
 		proxy: 'http://localhost:3000'
-	}
+	},
+	publicPath: '/static'
 }

+ 1 - 1
server.js

@@ -51,7 +51,7 @@ app.use('/api/v1/log', require('./routes/log'))
 app.use('/api/v1/poll', require('./routes/poll'))
 app.use('/api/v1/link_preview', require('./routes/link_preview'))
 
-app.use('/static', express.static(path.join(__dirname, 'frontend', 'dist', 'static')))
+app.use('/static', express.static(path.join(__dirname, 'frontend', 'dist')))
 app.get('*', (req, res) => {
 	res.sendFile(path.join(__dirname, 'frontend', 'dist', 'index.html'))
 })