Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const express = require('express');
- const bodyParser = require('body-parser');
- const cors = require('cors');
- const r = require('rethinkdbdash')({ db: 'tm_tieto' });
- process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
- const settings = {
- secret: 'd7cad03d66f2d263991b2412dc112b7e',
- site: {
- name: 'Tm-Tieto Oy',
- url: 'http://localhost:3000'
- },
- email: {
- from: "no-reply@tm-tieto.fi",
- host: "mail.tm-tieto.fi",
- user: "foo@bar.com",
- password: "somepassword",
- ssl: true
- }
- };
- const app = express();
- app.use(cors());
- app.use(bodyParser.json())
- .use(bodyParser.urlencoded({ extended: false }));
- const auth = require('chaos-auth')(r, settings);
- app.use('/auth', auth.router);
- app.get('/test', auth.authorize, (req, res) => {
- console.log('test works');
- res.send({ success: true, message: 'i am authorized' });
- });
- app.listen(3000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement