당신은 이런 식으로 뭔가를 찾고 계십니까 :
server.get /list\/[a-zA-Z]+/, (req,res,next) ->
document = docpad.getCollection('documents').findOne({relativeOutPath: 'index.html'});
docpad.serveDocument({
document: document,
req: req,
res: res,
next: next,
statusCode: 200
});
이 이벤트입니다 (서버을 확장합니다)를 docpad.coffee 파일에. 그것의 요청을 가로 챈 다음 regex에 대해 테스트합니다 (쉽게 일반 URL 일 수 있음). 사용자는 입력 한 URL을 볼 수 있지만 index.html이 제공됩니다.
또는 귀하의 경우에 더 가까이 : docpad.coffee
events:
# Server Extend
# Used to add our own custom routes to the server before the docpad routes are added
serverExtend: (opts) ->
# Extract the server from the options
{server} = opts
docpad = @docpad
# As we are now running in an event,
# ensure we are using the latest copy of the docpad configuraiton
# and fetch our urls from it
latestConfig = docpad.getConfig()
oldUrls = latestConfig.templateData.site.oldUrls or []
newUrl = latestConfig.templateData.site.url
server.post "*", (req,res,next) ->
#do stuff
내부
server.post "*", (req,res,next) ->
#do stuff