The repository is currently in a volatile state(deadline approaching). Don't pull from it before July...
nkc community project, version 2. Currently under dev.
Join our company. We expect applicants:
- Have good understanding of Promise in JavaScript.
- Have no problem reading ArangoDB's documentation.
- Can read/ write/ speak Chinese fluently.
You are allowed to use these files for any purpose, as long as you admit that they are useful[1]. The author of these files shall not be held responsible for any terrorist attacks or global climate changes caused by the use of these files.
[1] Before we change our mind.
- Framework: Express 4 (if you want to implement framework level features)
- Template Language: Jade (now called Pug. Best template language, ever)
- Database: ArangoDB (best of NoSQL)
- Image Processing: ImageMagick (one and only)
- Frontend Framework: Raw JavaScript + React (Admin Panel), need
Promisesupport in browser (Does not support IE before Polyfilling)
- 20160514: ImageMagick was found to contain security exploits that provides remote execution capabilities to hackers. Make sure you are using the latest version of ImageMagick (7.0.1-3 as for now), otherwise please do upgrade immediately.
-
ImageMagick
-
Windows
Official Site Download.
-
OS X
brew install ImageMagick -
CentOS
check
scriptsdirectory.
-
-
ArangoDB
-
Windows
Installer.
-
OSX
Installer. run ArangoDB-CLI.app directly from Applications.
-
CentOS
check
scriptsdirectory. Change the version number when necessary.
-
We are currently refactoring. To help, read the following carefully.
- (If the API is for data modification/retrieval) Visit localhost:8529. Learn AQL basics from ArangoDB Official Documentation. Write AQL. Test to see if your query works.
- Implement the API function in JavaScript. Please refer to
nkc_modules/api_operations/example.js. - Make sure the current user has
'dev'certificate (can call every API once implemented). To allow users with other certificates to call that API, Modifypermissions.js. - Reload Server.
-
In browser
<script src='/interface_common.js'/> <script> nkcAPI('exampleOperation',{someParameter:'someValue'}) .then(jalert) .catch(jalert) </script>
-
In general
An HTTP request should be made with cookies (for User Authentication) to
/api/operation, with JSON body.{ "operation":"nameOfOperation", "someParameter":"someValue" }
- Install Node.js, ImageMagick for your system and make sure
npmandmagickare available as commands from CLI. git clonethis project, or extract from zip, to somewhere nicenpm updatethere for the dependencies- Make sure ArangoDB is listening on localhost:8529, then run db_restore.command from Finder (OS X: may need
chmod +xfirst) orsh db_restore.command(UNIX) to load the database from JSON files - run run_as_dev.bat or run_as_dev.command to start the server in a CLI environment
- Press Enter in terminal window whenever to restart server. You may also visit
server:port/reloadto do the same
- 为你的操作系统安装Node.js 和 ImageMagick,并确保
npm与convert命令在命令行中可用 - 通过
git clone或者zip解压将本项目弄到某处 - 在该处
npm update以获取依赖项 - 确保 ArangoDB 在 localhost:8529 监听, 然后从Finder运行 db_restore.command (OS X: 可能需要先
chmod +x) 或者sh db_restore.command(UNIX) 以将JSON文件载入数据库 - 运行 run_as_dev.bat or run_as_dev.command 以从命令行启动服务器
- 在命令行窗口中随时按下 Enter 就可以重启服务器。 你也可以访问
server:port/reload实现同样效果
- Do all above and make sure things does work
- Install the forever package:
npm install forever -g - Bash:
sh run_as_production.shWindows CMD:run_as_production.sh(or doubleclick) - Report bugs when necessary.
scriptsdirectory contains various scripts to accelerate deployment- by default listens on localhost:1086
server_settings.jsincludes several globally used server parameters and static serving routes and URL rewrites- GET
server:port/html/jade/somenamewill respond with rendered/nkc_modules/jade/somename.jade - Every unrouted path will end up returning 404.jade
query_functions.jsis the database wrapperapi_functions.jscontains all the API functions. They are called before serving API/HTML requestsim_functions.jscontains wrapper for ImageMagick binaries.
