{"action":"created","issue":{"url":"https://api.github.com/repos/FreeCodeCamp/CurriculumExpansion/issues/26","repository_url":"https://api.github.com/repos/FreeCodeCamp/CurriculumExpansion","labels_url":"https://api.github.com/repos/FreeCodeCamp/CurriculumExpansion/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/FreeCodeCamp/CurriculumExpansion/issues/26/comments","events_url":"https://api.github.com/repos/FreeCodeCamp/CurriculumExpansion/issues/26/events","html_url":"https://github.com/FreeCodeCamp/CurriculumExpansion/issues/26","id":163737924,"number":26,"title":"Back End Challenges ","user":{"login":"atjonathan","id":11198912,"avatar_url":"https://avatars.githubusercontent.com/u/11198912?v=3","gravatar_id":"","url":"https://api.github.com/users/atjonathan","html_url":"https://github.com/atjonathan","followers_url":"https://api.github.com/users/atjonathan/followers","following_url":"https://api.github.com/users/atjonathan/following{/other_user}","gists_url":"https://api.github.com/users/atjonathan/gists{/gist_id}","starred_url":"https://api.github.com/users/atjonathan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atjonathan/subscriptions","organizations_url":"https://api.github.com/users/atjonathan/orgs","repos_url":"https://api.github.com/users/atjonathan/repos","events_url":"https://api.github.com/users/atjonathan/events{/privacy}","received_events_url":"https://api.github.com/users/atjonathan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"atjonathan","id":11198912,"avatar_url":"https://avatars.githubusercontent.com/u/11198912?v=3","gravatar_id":"","url":"https://api.github.com/users/atjonathan","html_url":"https://github.com/atjonathan","followers_url":"https://api.github.com/users/atjonathan/followers","following_url":"https://api.github.com/users/atjonathan/following{/other_user}","gists_url":"https://api.github.com/users/atjonathan/gists{/gist_id}","starred_url":"https://api.github.com/users/atjonathan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atjonathan/subscriptions","organizations_url":"https://api.github.com/users/atjonathan/orgs","repos_url":"https://api.github.com/users/atjonathan/repos","events_url":"https://api.github.com/users/atjonathan/events{/privacy}","received_events_url":"https://api.github.com/users/atjonathan/received_events","type":"User","site_admin":false},"assignees":[{"login":"atjonathan","id":11198912,"avatar_url":"https://avatars.githubusercontent.com/u/11198912?v=3","gravatar_id":"","url":"https://api.github.com/users/atjonathan","html_url":"https://github.com/atjonathan","followers_url":"https://api.github.com/users/atjonathan/followers","following_url":"https://api.github.com/users/atjonathan/following{/other_user}","gists_url":"https://api.github.com/users/atjonathan/gists{/gist_id}","starred_url":"https://api.github.com/users/atjonathan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atjonathan/subscriptions","organizations_url":"https://api.github.com/users/atjonathan/orgs","repos_url":"https://api.github.com/users/atjonathan/repos","events_url":"https://api.github.com/users/atjonathan/events{/privacy}","received_events_url":"https://api.github.com/users/atjonathan/received_events","type":"User","site_admin":false}],"milestone":null,"comments":23,"created_at":"2016-07-04T20:09:05Z","updated_at":"2016-07-11T19:13:49Z","closed_at":null,"body":"These should replace express-works.\r\n\r\n**Proposed Challenges:**\r\n- [ ] Create an Express.js app that outputs \"Hello World!\" when somebody goes to / (Similar to https://github.com/azat-co/expressworks/blob/master/exercises/hello_world/problem.md)\r\n- [ ] Using `pug` with views (Similar to https://github.com/azat-co/expressworks/blob/master/exercises/jade/problem.md)\r\n- [ ] Adding static middleware (Similar to https://github.com/azat-co/expressworks/blob/master/exercises/static/problem.md)\r\n- [ ] POST requests and forms (Similar to https://github.com/azat-co/expressworks/blob/master/exercises/good_old_form/problem.md)\r\n- [ ] Parameters (Similar to https://github.com/azat-co/expressworks/blob/master/exercises/param_pam_pam/problem.md)\r\n- [ ] Sending JSON (Similar to https://github.com/azat-co/expressworks/blob/master/exercises/json_me/problem.md)"},"comment":{"url":"https://api.github.com/repos/FreeCodeCamp/CurriculumExpansion/issues/comments/231834969","html_url":"https://github.com/FreeCodeCamp/CurriculumExpansion/issues/26#issuecomment-231834969","issue_url":"https://api.github.com/repos/FreeCodeCamp/CurriculumExpansion/issues/26","id":231834969,"user":{"login":"Daynil","id":4650666,"avatar_url":"https://avatars.githubusercontent.com/u/4650666?v=3","gravatar_id":"","url":"https://api.github.com/users/Daynil","html_url":"https://github.com/Daynil","followers_url":"https://api.github.com/users/Daynil/followers","following_url":"https://api.github.com/users/Daynil/following{/other_user}","gists_url":"https://api.github.com/users/Daynil/gists{/gist_id}","starred_url":"https://api.github.com/users/Daynil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daynil/subscriptions","organizations_url":"https://api.github.com/users/Daynil/orgs","repos_url":"https://api.github.com/users/Daynil/repos","events_url":"https://api.github.com/users/Daynil/events{/privacy}","received_events_url":"https://api.github.com/users/Daynil/received_events","type":"User","site_admin":false},"created_at":"2016-07-11T19:13:49Z","updated_at":"2016-07-11T19:13:49Z","body":"#  Sending a file\r\n\r\n#### Challenge Description\r\n\r\nYou'll want to send more than just simple strings with your express application. Luckily, express provides ways for you to do just that. Instead of serving a string, you can serve a file containing html, like `myhomepage.html`. \r\n\r\n```javascript\r\napp.get(\"/\", function (request, response) {\r\n  response.sendFile(__dirname + '/myhomepage.html');\r\n});\r\n```\r\nIf you want users see your homepage when they visit your base URL, you instruct express to send the desired file as the response to the `GET` request that the browser makes when a user visits your website.\r\n\r\n`__dirname` is a special node variable that represents the string of the directory where the current script (in this case, the express server script) resides. If your `myhomepage.html` resides in the same folder as your server, you would tell express to serve from the name of the current directory `__dirname` plus the name of the file within that folder that you want to serve.\r\n\r\n#### Instructions\r\n\r\nIf your `myhomepage.html` has a link to another page on your website called `about`, a user clicking that link would send a `GET` request to the route `/about`. In your code, serve up the file `aboutpage.html` in response to a request to that route.\r\n\r\n#### Seed code\r\n\r\n```javascript\r\nvar express = require('express');\r\nvar app = express();\r\n\r\napp.get(\"/\", function (request, response) {\r\n  response.sendFile(__dirname + '/myhomepage.html');\r\n});\r\n\r\n// Enter code below this line\r\n\r\n// Only change code above this line\r\n\r\napp.listen(3000, function() {\r\n    console.log('Serving on port 3000');\r\n});\r\n```\r\n\r\n#### Solution\r\n\r\n```javascript\r\nvar express = require('express');\r\nvar app = express();\r\n\r\napp.get(\"/\", function (request, response) {\r\n  response.sendFile(__dirname + '/myhomepage.html');\r\n});\r\n\r\n// Enter code below this line\r\n\r\napp.get(\"/about\", function (request, response) {\r\n  response.sendFile(__dirname + '/aboutpage.html');\r\n});\r\n\r\n// Only change code above this line\r\n\r\napp.listen(3000, function() {\r\n    console.log('Serving on port 3000');\r\n});\r\n```\r\n\r\n#### Tests\r\n\r\n```javascript\r\nvar fs = require('fs');\r\nvar request = require('request');\r\nvar base_url = 'http://localhost:3000/';\r\nvar aboutpg = fs.readFileSync(__dirname + '/aboutpage.html', 'utf-8');\r\n\r\ndescribe('Homepage server', function() {\r\n  describe('GET /about', function() {\r\n    it('returns status code 200', function(done) {\r\n      request.get(base_url+'about', function(err, res, body) {\r\n        expect(res.statusCode).toBe(200);\r\n        done();\r\n      });\r\n    });\r\n\r\n    it('returns the aboutpage.html file', function(done) {\r\n      request.get(base_url+'about', function(err, res, body) {\r\n        expect(body).toBe(aboutpg);\r\n        done();\r\n      });\r\n    });\r\n\r\n  });\r\n});\r\n```\r\n\r\n"}}
{"actor":{"display_login":"Daynil"}}