Last active
August 29, 2015 14:02
-
-
Save hamecoded/f50b7e14f0c8fe3a8ad9 to your computer and use it in GitHub Desktop.
The Secrets of the Full Stack Ninja Workshop - Part A - The Client Side
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # install a dev dependency that will automatically load all modules | |
| npm install --save-dev load-grunt-tasks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * An express server to serve a SPA app | |
| * we use express to simplify handling of static files | |
| * whilst directing all paths to main index.html | |
| * for handling browser refresh | |
| * a more complicate solution using standard modules can be found here: | |
| * https://coderwall.com/p/b2kmkg | |
| * an interesting discussion: | |
| * http://stackoverflow.com/questions/7268033/basic-static-file-server-in-nodejs | |
| */ | |
| var express = require('express'), | |
| app = express(); | |
| app.use(express.static(__dirname + '/public')); | |
| app.get('*', function (req, res) { | |
| res.sendfile(__dirname + '/public/index.html'); | |
| }); | |
| var server = app.listen(process.env.PORT || 8088, function() { | |
| console.log('Listening on port %d', server.address().port); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # adding a git tag | |
| git tag -a 0.0.1 -m "create a SPA server" | |
| git push --tags | |
| # showing a git tag | |
| git show 0.0.1 | |
| # deleting a git tag | |
| git tag -d 0.0.1 | |
| # linking tags in markdown for README | |
| Tags | |
| ------------------------------------------------------------------------------- | |
| * [tag 0.0.1] - in this tag we've reached the point where we have a server set to our SPA app | |
| [tag 0.0.1]:https://github.com/hamecoded/myBlog/tree/0.0.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment