Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- project - app - some files
- - build - index.js, index.html, etc.(I start the server by "node index.js")
- - node_modules - some modules
- - signup - some files to be minified
- - signin - some files to be minified
- - apache-cassandra-3.0.6 - bin, conf, etc.(downloaded from tarball)
- - package.json
- - webpack.config.js
- var client = new cassandra.Client({contactPoints:['127.0.0.1:9042']});
- OR
- var client = new cassandra.Client({contactPoints:['127.0.0.1']});
- var router = express.Router();
- var insertUser = 'INSERT INTO keyspace.users (username, create_time, email, password) VALUES (?, ?, ?, ?);';
- router.get"/", function(req, res) {
- res.sendFile(__dirname + '/index.html'); // This is working.
- });
- router.post("/signup", function(req, res) {
- var email = req.body.email;
- var password = req.body.password;
- client.execute(insertUser, [username, now(), email, password],
- { prepare: true }, function(err) {
- if (err) {
- console.log("error"); // I receive error.
- } else {
- console.log("success");
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement