Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. project - app - some files
  2. - build - index.js, index.html, etc.(I start the server by "node index.js")
  3. - node_modules - some modules
  4. - signup - some files to be minified
  5. - signin - some files to be minified
  6. - apache-cassandra-3.0.6 - bin, conf, etc.(downloaded from tarball)
  7. - package.json
  8. - webpack.config.js
  9.  
  10. var client = new cassandra.Client({contactPoints:['127.0.0.1:9042']});
  11. OR
  12. var client = new cassandra.Client({contactPoints:['127.0.0.1']});
  13.  
  14. var router = express.Router();
  15. var insertUser = 'INSERT INTO keyspace.users (username, create_time, email, password) VALUES (?, ?, ?, ?);';
  16.  
  17. router.get"/", function(req, res) {
  18. res.sendFile(__dirname + '/index.html'); // This is working.
  19. });
  20.  
  21. router.post("/signup", function(req, res) {
  22. var email = req.body.email;
  23. var password = req.body.password;
  24. client.execute(insertUser, [username, now(), email, password],
  25. { prepare: true }, function(err) {
  26. if (err) {
  27. console.log("error"); // I receive error.
  28. } else {
  29. console.log("success");
  30. }
  31. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement