Class: DynamicLinks::V1::ShortLinksController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- DynamicLinks::V1::ShortLinksController
- Defined in:
- app/controllers/dynamic_links/v1/short_links_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'app/controllers/dynamic_links/v1/short_links_controller.rb', line 2 def create url = params.require(:url) # validate url # if !url_shortener.valid_url?(url) # render json: { error: 'invalid url' }, status: :bad_request # return # end # shorten url # save to db (not implemented yet) render json: DynamicLinks.generate_short_url(url), status: :created end |