Browse Source

Add routes for society creation and update slug for user operations

Matt Coles 9 years ago
parent
commit
e69ffbc87b
4 changed files with 28 additions and 6 deletions
  1. 4 4
      README.md
  2. 9 0
      routes/society/create-society.js
  3. 9 0
      routes/society/view-society.js
  4. 6 2
      utils/route-manager.js

+ 4 - 4
README.md

@@ -8,8 +8,8 @@ Server for Integrated Project, powered by Express.js and Redis, listens only on
8 8
     * [Running](#running)
9 9
 * [API](#api)
10 10
     * [/hello/:name/](#helloname)
11
-    * [/register/](#register)
12
-    * [/auth/](#auth)
11
+    * [/register/](#userregister)
12
+    * [/auth/](#userauth)
13 13
 
14 14
 ### Installation
15 15
 Instructions are for OSX El Capitan at time of writing.
@@ -43,7 +43,7 @@ node index.js
43 43
 ### /hello/:name/
44 44
 Returns "Hello :name!" or simply "Hello World!" if no name is present. :)
45 45
 
46
-### /register/
46
+### /user/register/
47 47
 In order to register a new user account, a `POST` request should be sent, with
48 48
 the following data:
49 49
 ```javascript
@@ -62,7 +62,7 @@ The server will then respond with a JSON object that looks something like this:
62 62
 ```
63 63
 The value of the error code will be `1` if the username already exists.
64 64
 
65
-### /auth/
65
+### /user/auth/
66 66
 In order to log into an account, or essentially request a new authentication
67 67
 token, a `POST` request should be sent with the following data:
68 68
 ```javascript

+ 9 - 0
routes/society/create-society.js

@@ -0,0 +1,9 @@
1
+module.exports = {
2
+  perform: function(a,b) {
3
+    perform(a,b);
4
+  }
5
+}
6
+
7
+var perform = function(req,res) {
8
+  res.send("Attempted to create society");
9
+}

+ 9 - 0
routes/society/view-society.js

@@ -0,0 +1,9 @@
1
+module.exports = {
2
+  perform: function (a,b) {
3
+    perform(a,b);
4
+  }
5
+}
6
+
7
+var perform = function (req, res) {
8
+  res.send("Attempting to view society: " + req.params.societyid);
9
+};

+ 6 - 2
utils/route-manager.js

@@ -3,11 +3,15 @@ var router = express.Router();
3 3
 var hello = require("../routes/misc/helloworld.js");
4 4
 var register = require("../routes/user/register.js");
5 5
 var login = require("../routes/user/login.js");
6
+var soc_create = require("../routes/society/create-society.js");
7
+var soc_view = require("../routes/society/view-society.js");
6 8
 
7 9
 module.exports = router;
8 10
 
9 11
 router.get('/hello/(:name)?', hello.perform);
10 12
 
11
-router.all('/register/', register.perform);
13
+router.all('/user/register/', register.perform);
14
+router.all('/user/auth/', login.perform);
12 15
 
13
-router.all('/auth/', login.perform);
16
+router.all('/society/create', soc_create.perform);
17
+router.all('/society/view/:societyid', soc_view.perform);