Giter VIP home page Giter VIP logo

gs-rest-userinfo's Introduction

This is an example RESTful service built with Spring Boot.

Goal

The goal is to build a RESTful application that stores user information and provides the following functionality:

  • Get a list of users in the system
  • Create user
  • Update user
  • Change password for a given user

Usage

List Users

The service will handle GET requests for /users. The GET request should return a 200 OK response with JSON in the body that lists information about each of the users. The JSON should look something like this:

[
  {
    "username": "johndoe",
    "email": "[email protected]",
    "firstName": null,
    "lastName": null
  },
  {
    "username": "janedoe"
    "email": "[email protected]",
    "firstName": null,
    "lastName": null
  }
]

Create a User

The service will handle POST request for /users. The POST request should return a 201 CREATED response. The resource for the new user should be available at /users/{username} where {username} is the name of the user.

After the resource is created, the service will handle GET request for /users/{username}. The GET request should return a 200 OK response. The response body will be JSON and it should look something like this:

{
  "username": "johndoe",
  "email": "[email protected]",
  "firstName": null,
  "lastName": null
}

Update a User

The service will handle PUT request for /users/{username} where {username} is the name of the user. If the resource already exists, then it will be updated. Otherwise, a new user will be created and the resource will be available.

Note that PUT replaces the entire resource. Fields not supplied will be replaced with null.

Change password

A PUT request for /users/{username} can be used to change the password for the user with name {username}.

See Also

The following guides may also be helpful:

gs-rest-userinfo's People

Contributors

ruibo avatar

Watchers

 avatar  avatar

gs-rest-userinfo's Issues

Hash the user's password

Currently, the example is storing the user's password as plain text. A better practice is to hash the password. Consider using org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder.

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.