Просмотр исходного кода

Add routes for society creation and update slug for user operations

Matt Coles лет назад: 9
Родитель
Сommit
e69ffbc87b
4 измененных файлов с 28 добавлено и 6 удалено
  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
     * [Running](#running)
8
     * [Running](#running)
9
 * [API](#api)
9
 * [API](#api)
10
     * [/hello/:name/](#helloname)
10
     * [/hello/:name/](#helloname)
11
-    * [/register/](#register)
12
-    * [/auth/](#auth)
11
+    * [/register/](#userregister)
12
+    * [/auth/](#userauth)
13
 
13
 
14
 ### Installation
14
 ### Installation
15
 Instructions are for OSX El Capitan at time of writing.
15
 Instructions are for OSX El Capitan at time of writing.
43
 ### /hello/:name/
43
 ### /hello/:name/
44
 Returns "Hello :name!" or simply "Hello World!" if no name is present. :)
44
 Returns "Hello :name!" or simply "Hello World!" if no name is present. :)
45
 
45
 
46
-### /register/
46
+### /user/register/
47
 In order to register a new user account, a `POST` request should be sent, with
47
 In order to register a new user account, a `POST` request should be sent, with
48
 the following data:
48
 the following data:
49
 ```javascript
49
 ```javascript
62
 ```
62
 ```
63
 The value of the error code will be `1` if the username already exists.
63
 The value of the error code will be `1` if the username already exists.
64
 
64
 
65
-### /auth/
65
+### /user/auth/
66
 In order to log into an account, or essentially request a new authentication
66
 In order to log into an account, or essentially request a new authentication
67
 token, a `POST` request should be sent with the following data:
67
 token, a `POST` request should be sent with the following data:
68
 ```javascript
68
 ```javascript

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

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

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
 var hello = require("../routes/misc/helloworld.js");
3
 var hello = require("../routes/misc/helloworld.js");
4
 var register = require("../routes/user/register.js");
4
 var register = require("../routes/user/register.js");
5
 var login = require("../routes/user/login.js");
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
 module.exports = router;
9
 module.exports = router;
8
 
10
 
9
 router.get('/hello/(:name)?', hello.perform);
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);