-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
139 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.* | ||
!.gitignore | ||
node_modules | ||
npm-debug.log | ||
/config/*.json |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,15 @@ | ||
# forester-boilerplate | ||
# forester-boilerplate | ||
|
||
## Getting started | ||
|
||
1. Install dependencies ` $ npm install ` | ||
2. Copy `config/auth.json.dist` to `config/auth.json` and configure this file | ||
3. Copy `config/db1.json.dist` to `config/db1.json` and configure this file | ||
4. Start project `$ npm start` | ||
5. Open `http://localhost:3000` | ||
|
||
## Contributing | ||
Your contributions (issues and pull request) are appreciated! | ||
|
||
### License | ||
MIT |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"jwt": { | ||
"secret": "change_me" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "db1", | ||
"adapter": "mongo", | ||
"options": { | ||
"connectionUri": "mongodb://localhost:27017/forester" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "forester-boilerplate", | ||
"version": "0.0.0", | ||
"description": "A boilerplate project based on forester", | ||
"scripts": { | ||
"start": "node src/server.js" | ||
}, | ||
"dependencies": { | ||
"forester": "^0.4.0", | ||
"forester-auth": "^0.1.4", | ||
"forester-explorer": "^0.1.4" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Forester Boilerplate</title> | ||
</head> | ||
<body> | ||
Hello! This is a Forester boilerplate project! | ||
</body> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"use strict"; | ||
|
||
module.exports = function (config) { | ||
|
||
return function (forester) { | ||
//do something with forester | ||
console.log("sample plugin started"); | ||
}; | ||
|
||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"use strict"; | ||
|
||
// libraries | ||
const path = require('path'); | ||
const Forester = require('forester'); | ||
const foresterExplorer = require("forester-explorer"); | ||
const foresterAuth = require("forester-auth"); | ||
const samplePlugin = require("../src/sample-plugin.js"); | ||
|
||
//project items | ||
const collections = [ | ||
require('../structure/articles.json') | ||
]; | ||
const dataSources = [ | ||
require('../config/db1.json') | ||
]; | ||
const mappings = require('../structure/mappings.json'); | ||
const authConfig = require('../config/auth.json'); | ||
|
||
//init forester | ||
var app = new Forester(); | ||
|
||
//add plugins | ||
app.use(foresterExplorer()); | ||
app.use(foresterAuth(authConfig)); | ||
app.use(samplePlugin()); | ||
|
||
//register project items | ||
app.registerCollections(collections); | ||
app.registerDataSources(dataSources); | ||
app.registerMappings(mappings); | ||
|
||
//register project public folder | ||
app.registerStaticRoute({route: '/', failback: "index.html", path: path.join(__dirname, '../public')}); | ||
|
||
//boot | ||
app.boot() | ||
.then(function () { | ||
app.listen({port: 3000}); | ||
}) | ||
.catch(function (e) { | ||
console.log(e.stack); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "articles", | ||
"properties": { | ||
"title": { | ||
"type": "string", | ||
"required": true | ||
}, | ||
"description":{ | ||
"type": "string", | ||
"default": "default description", | ||
"required": true | ||
} | ||
}, | ||
"defender": [ | ||
{ | ||
"action": "*", | ||
"check": "skip" | ||
} | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"collection": "articles", | ||
"datasource": "db1" | ||
}, | ||
{ | ||
"collection": "_users", | ||
"datasource": "db1" | ||
}, | ||
{ | ||
"collection": "_tokens", | ||
"datasource": "db1" | ||
} | ||
] |