Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

5. dil serialu

  • Loading branch information...
commit 25afacf0382879308a90122a8f33240544908e0d 1 parent 42767ab
@JakubMrozek authored
View
17 .gitignore
@@ -0,0 +1,17 @@
+nbproject
+node_modules
+
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
+*.gz
+
+pids
+logs
+results
+
+npm-debug.log
View
1  Procfile
@@ -0,0 +1 @@
+web: node server.js
View
55 app/pages.js
@@ -0,0 +1,55 @@
+// testovaci data
+var pages = {
+ 'obchodni-podminky': {
+ 'title': 'Obchodní podmínky',
+ 'content': 'Lorem ipsum set dolorem'
+ },
+ 'doprava-a-platba': {
+ 'title': 'Obchodní podmínky',
+ 'content': 'Lorem ipsum set dolorem'
+ },
+ 'kontakt': {
+ 'title': 'Kontakt',
+ 'content': 'Lorem ipsum set dolorem'
+ }
+};
+
+/**
+ * GET /pages
+ */
+exports.index = function(req, res){
+ res.json(pages);
+};
+
+/**
+ * GET /pages/:page
+ */
+exports.show = function(req, res){
+ page = pages[req.params.page];
+ if (page) {
+ res.json(page);
+ } else {
+ res.send(404);
+ }
+};
+
+/**
+ * POST /pages
+ */
+exports.create = function(req, res){
+ //...
+};
+
+/**
+ * PUT /pages/:page
+ */
+exports.update = function(req, res){
+ //...
+};
+
+/**
+ * DELETE /pages/:page
+ */
+exports.destroy = function(req, res){
+ //...
+};
View
17 package.json
@@ -0,0 +1,17 @@
+{
+ "name": "zdrojak",
+ "version": "0.0.1",
+ "main": "server.js",
+ "scripts": {
+ "start": "node server.js"
+ },
+ "dependencies": {
+ "express": "3.0.x",
+ "express-resource": "1.0.x"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/JakubMrozek/Zdrojak.git"
+ },
+ "author": "Jakub Mrozek"
+}
View
6 server.js
@@ -0,0 +1,6 @@
+var express = require('express')
+ , require('express-resource')
+ , app = express();
+
+app.resource('pages', require('./app/pages'));
+app.listen(process.env.PORT || 5000);
Please sign in to comment.
Something went wrong with that request. Please try again.