GithubHelp home page GithubHelp logo

benruwel / orgnewsportal Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 1.0 46 KB

REST API for storing and querying scoped news and information within an organization

Home Page: https://org-news-portal.herokuapp.com/

License: MIT License

Java 100.00%
api-rest spark-api java-8 heroku-deployment

orgnewsportal's Introduction


Organisational News Portal

REST API for querying and retrieving scoped news and information within an organization

Ben Ruwel

Table of Contents

About The Project

This is a REST API that is used to post news, view information of departments and its employees(users). It has features that allows one access specific info about users and departments, view a list of all the users in a department and also the list of departments a user is associated with.

Built With

This is program is wholely written in Java and built with

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

In order to build this app locally, first make sure you have all the programs listed in Built with. Some can be added as dependencies, please check with the build tool you wish to use.o

Installation

  1. Clone the repo

    $ git clone https://github.com/benruwel/OrgNewsPortal.git
  2. If you don't have Postgres installed on your local PC visit this to install it

  3. Enable gradle to import all the dependencies automatically

Usage

This api is hosted on Heroku, so you can choose to consume using this link https://org-news-portal.herokuapp.com/

These are the REST api routes:

Behavior Path Http Verb
Create a new departmetnt /department/new POST
Delete a specific department /department/:department_id DELETE
View info a specific department /department/:departmetn_id GET
Get a list of all departments /departments GET
Create a new user/employee /users/new POST
Get a list of users /users GET
Post news about a specific department /departments/:department_id/news/new POST
Get a list of the news relating to specific department /departments/:department_id/news GET
Add a user to a department departments/:department_id/user/:user_id/new POST
View a list of the employees/users in a department /departments/:department_id/users GET
View list of departments an employee is associated with /user/:user_id/departments GET

You may also choose to build this project locally and consume the api with the localhost port with the following steps:

  1. Open your preferred terminal

  2. You will need to create the databases with a specific schema, navigate to src/main/resources/DB and run this command

    $ psql > create.sql
    

    This creates org_news_portal (developmetn db) and org_news_portal_test (test db) on your local machine

    If in any instance you will require to delete the databases, run this:

    $ psql > drop.sql
  3. Then to run the project, navigate to your project's root directory run the project with

    $ gradle run
  4. Open postman and use the localhost:4567 URL to test the endpoints stipulated above.

BDD

This project uses Gson to change Java objects to JSON format, which is the golden standard for most apis.

POST method behavior:

  • User fires a POST method e.g. POST department/new, though the data may differ according to the given body object, there will be a similar 201 response with the generated Json object.
    {
        "name": "HR",
        "id": 2,
        "description": "Comfortable workspaces to thrive in",
        "number_of_employees": 2
    }

GET method behavior

  • User fires a GET method e.g. GET /departments, in this case, the response will be a Json object with an array of all the departments.
    [
        {
            "name": "Software Dev",
            "id": 1,
            "description": "Hot Java all day, both coffee and code",
            "number_of_employees": 10
        },
        {
            "name": "HR",
            "id": 2,
            "description": "Comfortable workspaces to thrive in",
            "number_of_employees": 2
        }
    ]

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

My email - [email protected]

Acknowledgements

orgnewsportal's People

Contributors

benruwel avatar

Stargazers

 avatar

Forkers

breens-mbaka

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.