Doing POST and PUT in a Sinatra application

Hello,

I am using Sinatra to write an application that would act on GET, POST,
PUT and DELETE actions. I have coded the GET part as follows-

get '/' do
    @CNs = Data.all()
    erb :index
end

The index.erb in ./views has all the rendering logic.

Thus, the get block calls the index.erb file. How should POST and PUT
should be coded ?

post '/addnew/:id' do |id|
    erb :addnew
end

If addnew.erb will POST and action will be ‘/addnew/5’, then it will
call the post block again, Isn’t ?

I think, I shouldn’t call the erb :addnew. Instead something else
should be done.

I am sure this is a very basic thing and a lot of people could have gone
through this step earlier. Any suggestion ?

Thanks in Advance,

+Vipul ;