postit is a simple application that allows friends and colleagues create groups for notifications. This way one person can post notifications to everyone by sending a message once. The application allows people create accounts, create groups and add registered users to the groups, and then send messages out to these groups whenever they want.
The application was developed with NodeJs and Express is used for routing. The Postgres database was used with sequelize as the ORM The frontend was built using reactJs with redux framework.
The API has routes, each dedicated to a single task that uses HTTP response codes to indicate API status and errors.
The following features make up the PostIt Application Api:
- It makes use of jsonwebtoken(jwt) for authentication
- It generates a token on successful login and send it as part of response
- It accepts the generated token before given access to all the protected routes
- It allows users to be created.
- It allows users to login
- It allows new Group to be created by users.
- It ensures all Groups are accessible based on the permission specified.
- It allows creator of group to add members to the group
- It ensures members of group can add and retrieve messages to group and from group
EndPoint | Functionality |
---|---|
POST /api/user/signin | Logs a user in. |
POST /api/user/signup | Create a new user. |
GET /api/user | Get all users. |
POST /api/group | Creates a new group. |
POST /api/group/groupid/user | Add user to group. |
POST /api/group/groupid/message | Add message to group. |
GET /api/group/groupid/message | Get all messages that belongs to group. |
-
POST
/api/user/signup
Use this route to create an account. The following fields are required:username
The first name of the new useremail
Email address of the new userpassword
A secure passwordphoneNumber
Phone number
-
POST
/api/user/signin
Use this route to sign in to the application. The following fields are required:email
Email address of the new userpassword
A secure password
-
POST
/api/group
Use this route to create a new group. The following fields are required:name
The title of the groupdescription
A description of the purpose of the group
-
POST
/api/group/<groupId>/user
Use this route to add a user to a pre-existing groupusername
The username of a user registered on the application
-
POST
/api/group/<groupId>/message
Use this route to post a message to a groupcontent
The body of the message to be posted to the group
-
GET
/api/group/<groupId>/messages
Use this route to get messages made to a group -
GET
/api/user
Use this route to load all registered members
- NodeJS: is an open-source, cross-platform JavaScript run-time environment for executing JavaScript code on the server-side.
- Javascript ES6: ES6 is the sixth major release of the javascript language specification. It enables features like constants, arrow functions, template literals, spread opeartor, etc.
- React: Facebook open source, efficient, javascript library for building front-end projects.
- PostgreSQL: PostgreSQL is a powerful, open source object-relational database system (ORDBMS) that offers modern database features such as complex queries, foreign keys, etc.
- Sequelize: Sequelize is a promise-based ORM for Node.js that supports different dialects such PostgreSQL, MySQL, and SQLite.
- Babel: Babel transpiles es6 codes to es5.
- Webpack: Webpack is used to bundle modules and does tasks automation.
- Axios: Axios is an http client library used in consuming API.
- Ensure you have NodeJs and postgres installed
- Clone the repository
https://github.com/jchinonso/PostIt
- Change your directory
cd PostIt
- Install all dependencies
npm install
- Start the app
npm run start:dev
for development Or - Run
npm start
to use transpiled code - Use postman to consume the API
- The tests have been written using Mocha framework and Chai assertion library
- Run the test with
npm test
- Group creator cannot remove users from groups
- Users cannot update their profile
- Users cannot deactivate their accounts
- Airbnb: Airbnb is a coding style guide that guides developers to write clean codes
- Fork this repository.
- Clone it.
- Create your feature branch on your local machine with
git checkout -b your-feature-branch
- Push your changes to your remote branch with
git push origin your-feature-branch
- Open a pull request to the master branch, and describe how your feature works
- Refer to this wiki for proper GIT CONVENTION
Ensure your codes follow AirBnB Javascript Styles Guide
The full API documentation can be viewed at here
Johnson Chinonso