Jatin,

Here's the relevant documentation on expressjs.com:

http://expressjs.com/api.html#req.params

Cheers,
Phil

Jatin Patel <[email protected]> writes:

> Thank you Phil.
>
> On #2) so app.get("/events/:event_name") - here event_name is not url_name 
> so how does it ever route to proper URL? event_name is: Chicago, the 
> Musical and eventURL (named) would be chicago-the-musical.
> #3) Sorry, can you explain this bit more? I don't understand. 
>
>
> Thanks,
> Jatin
>
> On Tuesday, March 19, 2013 4:56:42 PM UTC-4, Phil Jackson wrote:
>>
>> Hey Jatin, 
>>
>> Assuming I'm understanding your question: 
>>
>> 1) Have an extra column in the DB (uniquely constrained, indexed) called 
>>    url_name or something and put "chicago-the-musical" in there when the 
>>    venue has registered. 
>> 2) Add a controller app.get("/events/:envent_name") 
>> 3) When someone hits /events/chicago-the-musical look up the value in 
>>    the new url_name column. 
>> 4) Something. 
>> 5) Profit. 
>>
>> Cheers, 
>> Phil 
>>
>> Jatin Patel <[email protected] <javascript:>> writes: 
>>
>> > Hello fellow Node'rs, 
>> > 
>> > I'm moving forward and getting close here with respect to my startup... 
>> > here's some background 
>> > - https://groups.google.com/d/topic/nodejs/77TqZeWiEZM/discussion 
>> > 
>> > I have another question and can't find direct documentation although 
>> many 
>> > articles on similar topic... 
>> > 
>> > I create bunch of events - and each event is stored in the db (mysql) - 
>> > each event row has IdEvent, eventName, etc..and also a blank column 
>> called 
>> > "eventURL". 
>> > now, what I want to do is - everytime an event is created by a venue, it 
>> > gets stored in the databae and also an event-Detail page gets created - 
>> > with the eventName as the name of the url. for e.g. if the eventName is" 
>> > Chicago, the musical" - it would create a  new eventDetail page using 
>> jade 
>> > template for event detail page that I have and it would name this url 
>> > (including routing) as chicago-the-musical. 
>> > How can I do this programmatically vs. manually creating 
>> > app.get(/chicago-the-musical.jade)? 
>> > I'm using Express, Jade... 
>> > 
>> > Here's my current thinking - but am sure there's another way - also how 
>> do 
>> > I turn eventName in to eventURL - named... 
>> > --> router.js 
>> > - app.get('/events', events.eventList); 
>> > [Jatin] or does this need to look like this: 
>> > app.get('/events/idEvent', events.eventList);?? 
>> > also, how does /events turn in to /chicago-the-musical? 
>> > 
>> > --> events.js 
>> > - exports.eventList(….){ 
>> > // call to data access and get list of all the events without a URL 
>> > - get a list of events… 
>> > - for each event in eventArray 
>> > { 
>> > 1) Create Page URL (escape regex, replace spaces, commas, etc. with a 
>> > hyphen) - how? 
>> > 2) Store page URL in db in the event row column eventURL 
>> > 3) res.render('eventPage', { 
>> > locals: { 
>> > eventData: event 
>> > } 
>> > }); 
>> > } 
>> > }) 
>> > 
>> > 
>> > Thanks, 
>> > Jatin 
>> > 
>> > -- 
>>
>>
>> -- 
>> Apiaxle http://apiaxle.com - A free, open proxy for your API. 
>>
>
> -- 


-- 
Apiaxle http://apiaxle.com - A free, open proxy for your API.

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to