wejsserver
v1.0.2
Published
We (micro) JavaScript Written Server Based on Express And MongoDB
Downloads
2
Maintainers
Readme
WeJsServer
WeJsServer is a we (micro) JavaScript written server based on express and mongodb. Core features include:
- Fast and simple routes deployment based on file structure
- Simple mongodb CRUD API
- Extensible configuration definitions and processors
- Lean and extensible core
Note that WeJsServer will be intergrated into nicolas1.1.
Requires
Just keep following latest node.js version.
How to use
Create
get
,post
,put
ordelete
JavaScript files in directoryroutes
like/routes/api/sample/post.js
below:'use strict'; module.exports = (req, res, db, idGenerator, shaGenerator) => { let data = req.body.data || {}; db.insert({ model: 'sample', data: { _id: idGenerator.id(), name: data.name || 'unknown' }, callback: data => { res.send({ code: 0, msg: 'success', data: data[0] }); } }); };
Change directory to
/bin
, type the following command:node start
Stay in Touch
For further updates, please follow my blog and GitHub repository wejsserver.
License
Copyright (c) 2016 Nicolas Wan