Skip to content

Commit

Permalink
Merge pull request #18 from MLH-Fellowship/redirect
Browse files Browse the repository at this point in the history
Updated Compile and Serving Endpoints
  • Loading branch information
aemmadi authored Aug 21, 2020
2 parents 7c2b233 + e228efd commit 3c27056
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ const port = process.env.PORT || 3000;

app.use("/", express.static("docs"));

app.get("/:user/:repo/compile", (req, res) => {
app.get("/:user/:repo", (req, res) => {
const user = req.params.user;
const repo = req.params.repo;

util.compileDocs(user, repo).then(() => {
util.serveDocs(app, user, repo);
res.send(`Successfully Compiled Docs! View them at /${user}/${repo}`);
res.redirect(`/docs/${user}/${repo}/`);
});
});

Expand Down
2 changes: 1 addition & 1 deletion util.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async function getReadme(user, repo) {

// Serves the compiled docs
function serveDocs(app, user, repo) {
app.use(`/${user}/${repo}`, express.static(`./_docs/${user}-${repo}`));
app.use(`/docs/${user}/${repo}`, express.static(`./_docs/${user}-${repo}`));
}

async function getConfig(user, repo) {
Expand Down

0 comments on commit 3c27056

Please sign in to comment.