https://github.com/ejunjsh/weweb
a nodejs webapp framework
https://github.com/ejunjsh/weweb
Last synced: 3 months ago
JSON representation
a nodejs webapp framework
- Host: GitHub
- URL: https://github.com/ejunjsh/weweb
- Owner: ejunjsh
- Created: 2016-09-28T08:19:51.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-17T07:08:02.000Z (almost 7 years ago)
- Last Synced: 2024-12-29T08:41:52.249Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 7.72 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# weweb
a nodejs webapp framework,is similar to express.just for people to know how express works,inspired by
[](https://www.npmjs.com/package/weweb)
[](https://www.npmjs.com/package/weweb)
[](https://github.com/ejunjsh/weweb)## install
```bash
npm install weweb --save
```## example
````javascript
var http = require("http");
var weweb=require("weweb");
var app =weweb.app;app.use("/*",weweb.queryString);
app.use("/*",weweb.cookies);
app.use("/*",weweb.session);
app.use("/*",weweb.body);
app.use("/node_modules/weweb/*",weweb.staticFile);
app.get("/",function(req,res){
res.writeHead(200);
res.end("hello node.js");
});
app.get("/hello",function(req,res){
res.writeHead(200);
res.end("hello node.js");
});app.get("/hello:hahah",function(req,res){
res.writeHead(200);
res.end("hello node.js"+req.params.hahah);
});
app.use("/test*",weweb.render);
app.get("/test2",function(req,res){
return res.render("view1.html",{user:{name:"jack shao"}});
});app.get("/test1",function(req,res){
return res.render("view3.html",{user:{name:"jack shao"}});
});app.get("/test3",function(req,res){
return res.render("view4.html",{user:{name:"jack shao"}});
});http.createServer(app.bind).listen(4090);
console.log("Server has started.Listening on port:4090");
````