0.4.4 • Published 6 years ago

tnema v0.4.4

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

TNEMA

Server Bundle with: TypeScript + Node + Express + MongoDB + Authentication

NPM

Work Progress:

  • Core functionalities: done
  • Http Server: done
  • MongoDB Server: done
  • Authentication Server: done
  • Security: in testing *

*Security: express-session is no longer used. Instead, was create a cookie/token logic to authenticate users. Clients should send tokenid every request to check authentication thru header (see test.js and test/ folder for example)

Requirements

# if you are running thru TypeScript, install it before:
npm install typescript

# also requires @types
npm install @types/body-parser @types/express @types/cookie-parser @types/mongoose

Also requires an instance of MongoDB running.

Install

# install TNEMA Server
npm install tnema --save

Usage

To start a server with static routing on './public':

  tnema = require('tnema');
  
  // create server instance with session-name and session-file  
  server = new tnema.TNEMAServer('sessionName','./appSessions.json');
  
  // define port
  server.Port = 3000;

  // define cookie maxage = days * hours * minutes * seconds * ms
  server.Options.maxAge = 30 * 24 * 60 * 60 * 1000;
  
  // define the source of mongodb
  server.MongoSource = 'mongodb://localhost/test';
  
  // add static route to public folder
  server.HttpServer.RouteStatic(__dirname + '/public');

  // add route to /test and send the content
  server.HttpServer.App.get('/test', (req, res) => {
      res.send('Test Sucessfully');
  });
  
  // start server
  server.Create(function(){
    console.log('Server started at port: 3000');
  });

License

MIT

0.4.4

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.8

6 years ago

0.3.7

6 years ago

0.3.6

6 years ago

0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.9

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago