Git Product home page Git Product logo

movies's Introduction

Build Status

Description

This Spring boot project shows simple CRUD operations with a REST API and CI integration with Travis CI

It also shows Authentication using Spring Security

Travis CI deploys the code to Google Cloud Platform(GCE)

Test Link

I have deployed the application to http://saf.beatbox.co.ke/ with Travis for testing

Sample output

This was taken using Postman 1.png

2.png

Building

  1. Install Grails.Grails is used to provide the json-views needed to render json with HAL

  2. clone this repository and open it in IntelliJ

  3. Open a terminal and make sure you cd to the project root

  4. Run grails run-app and open http://localhost:8080/

Authorization.

This uses Spring Security

  1. POST: /api/login.The default credentials are {"username": "user", "password": "pass"}.The header Accept: application/json

  2. You will get an authorization token from the above step. Pass it as a header in the following subsequent API calls Authorization: Bearer <Access_Token>

Create

  1. POST: /api/movies Parameters { "name" :"Test Movie", "dateCreated" : "12/12/2018", "rating" : 3.5, "isReleased" : false }

Update

  1. PUT: api/movies/1 Parameters { "name" :"Test Movie", "dateCreated" : "12/12/2018", "rating" : 3.5, "isReleased" : false }

READ

  1. GET :/api/movies/1
  2. To get all the movies: GET: api/movies

DELETE

  1. DELETE: /api/movies/1

Testing

All the unit tests are under src/test

The two tests check if login is working and that a movie can be saved with the correct entities or can't otherwise.

CI and CD with Travis

The repository is integrated with Travis CI. The configuration file can be found at .travis.yml

Once a user commits to the master branch, Travis runs the automated tests and if they succeed it deploys it with the deploy.sh file.

The deploy.sh file simply pushes the code to the server. On the server a git post-receive hook builds a war file and deploys it to Tomcat webapps folder.

movies's People

Contributors

bdhobare avatar

Watchers

James Cloos avatar  avatar

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.