uprighted-learners / g3-react-chat

react-chat-aidrian created by GitHub Classroom
0 stars 1 forks source link

add user endpoint and implement it to api/index.js #9

Closed aidanho1188 closed 8 months ago

aidanho1188 commented 9 months ago

add create user endpoint and also implement it with create room endpoint to api/index.js.

// api/index.js
import {Router} from 'express';
import {createUser} from './users';
import {addMessage} from './messages';
import {createRoom} from './rooms';

const router = Router();

router.post('/rooms', createRoom);
router.post('/users', createUser);
router.post('/messages', addMessage);

export default router;

There is another index.js file in the route folder, we will use it later as a main file to access all of the endpoints. Best MERN practice: https://github.com/nemanjam/mern-boilerplate/blob/master/server/src/routes/index.js close #7