Code Monkey home page Code Monkey logo

subway-map's People

Contributors

brainbackdoor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

subway-map's Issues

MapController์˜ findPath ํ•ธ๋“ค๋Ÿฌ ๋ฉ”์„œ๋“œ์˜ ๊ฒฝ๋กœ๊ฐ€ ์ž˜๋ชป๋œ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

@RestController
public class MapController {
    ...

    @GetMapping("/paths")
    public ResponseEntity<PathResponse> findPath(@RequestParam Long source, @RequestParam Long target) {
        return ResponseEntity.ok(mapService.findPath(source, target));
    }
}

findPath์˜ ํ•ธ๋“ค๋Ÿฌ ๋ฉ”์„œ๋“œ๋Š” /paths ์ž…๋‹ˆ๋‹ค.
์—ฌ๊ธฐ์„œ @RequestParam์œผ๋กœ ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ์ถ”๊ฐ€๋กœ ๋ฐ›๊ณ  ์žˆ๋Š”๋ฐ ์ด๋•Œ ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ํฌํ•จํ•œ ๊ฒฝ๋กœ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

paths?source=1&target=2

ํ…Œ์ŠคํŠธ ์ฝ”๋“œ์—์„œ๋„ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

@DisplayName("์ง€ํ•˜์ฒ  ๊ฒฝ๋กœ ์กฐํšŒ")
public class PathAcceptanceTest extends AcceptanceTest {
    ...
    public static ExtractableResponse<Response> ๊ฑฐ๋ฆฌ_๊ฒฝ๋กœ_์กฐํšŒ_์š”์ฒญ(long source, long target) {
        return RestAssured.given().log().all().
                accept(MediaType.APPLICATION_JSON_VALUE).
                when().
                get("/paths?source={sourceId}&target={targetId}", source, target).
                then().
                log().all().
                extract();
    }
    ...
}

ํ•˜์ง€๋งŒ ์›น์„ ํ†ตํ•ด ์š”์ฒญ์„ ๋ณด๋‚ด๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์€ URL๋กœ ์š”์ฒญ์„ ๋ณด๋ƒ…๋‹ˆ๋‹ค.

image

์›์ธ์„ ํŒŒ์•…ํ•œ ๊ฒฐ๊ณผ, frontend/src/api/modules/path.js ํŒŒ์ผ์—์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ API ์š”์ฒญ์„ ๋ณด๋‚ด๋Š” ๊ฒƒ์„ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค.

const PathService = {
  get({ source, target }) {
    return ApiService.get(`${BASE_URL}/?source=${source}&target=${target}`)
  }
}

ํ˜„์žฌ ์Šคํ”„๋ง ๋ถ€ํŠธ ๋ฒ„์ „(2.4.0)์—๋Š” ๋ฌธ์ œ๊ฐ€ ์—†์ง€๋งŒ, ๋ฒ„์ „์„ ์˜ฌ๋ ธ์„ ๋•Œ(3.2.1) 404 ์ƒํƒœ ์ฝ”๋“œ๊ฐ€ ๋ฐ˜ํ™˜๋˜๋Š” ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.
๋”ฐ๋ผ์„œ ์ง€๊ธˆ ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ๋Š” ์—†์ง€๋งŒ ๐Ÿ˜… ์ถ”ํ›„ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ๊ฐ€๋Šฅ์„ฑ์ด ์žˆ์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

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.