node.js - Clean URLs (possibly with slug) -


i using mongodb store data. , default _id long , not-clean. routes like: example.com/job/sdg3463retgeragsehxcwe35435ert5

works fine.

but there way auto increment numbers , save custom id (with field name like, serial_number)?

i implemented way: created collection store last saved serial number. while saving new data, increment it. works fine, there better way?

also, how save urls slug instead of ids? need separate collection store slug , relevant id?

what if use raw mongodb _id? going hurt seo drastically? or other issues?

this works fine, wondering how pros it.

if willing have alphanumeric ids shortid module works pretty well. https://github.com/dylang/shortid

if want actual slugs , using mongoose try mongoose-uniqueslus module. https://github.com/punkave/mongoose-uniqueslugs.git


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -