npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nodetyped

v0.1.2

Published

A Node.js starter kit featuring Secuential Asynchrony (async/await), Express (Routing middlewares, Web, Api), Typescript, Mongoose, SCSS, EJS, Nodemon, Bootstrap 4, TSLint.

Downloads

13

Readme

NodeTyped

A Node.js starter kit featuring ES6 with Secuential Asynchrony (async/await), Express (Routing middlewares, Web, Api), Typescript, Mongoose, MongooseClass, SCSS, EJS, Nodemon, Bootstrap 4, TSLint, Jasmine, JsDoc, .

  • Simple npm setup and maintenance, without grunt/gulp/webpack/...

  • Support for async/await

Example middleware:

async function(req, res, next) {
    let title = 'NodeTyped Express';
    try {
        let data = await readFile(file, 'utf-8'); // no callbacks!
        res.render('index', { title: title, dump: data });
    } catch (e) {
        next(e);
    }
}

Example model:

@Model({})
export class User extends MongooseModel {

    @Column({ type: String, index: true })
    name: string;

    @Column(Number)
    age: number;

    static list(): Promise<any> {
        return this.find().exec();
    }

    greet() {
        return `Hello I'm ${this.name}`;
    }

}

Requirements

Make sure you have node version >= 4.0

Clone and Install dependencies

# clone the repo
# --depth 1 removes all but one .git commit history
git clone --depth 1 https://github.com/jamg44/NodeTyped.git projectname

# change directory to your new project
cd projectname

# install the repo dependencies with npm
npm install

# start the server
npm run dev

If you want to use mongoose models, start mongodb, check localConfig.js and:

# load sample products in database (defaults to 'test')
npm run loadMocks

Develop

Watch mode

You can start the server in development mode (linter included) with:

npm run dev

Open the browser at:

  • http://localhost:3000

Start MongoDB, run 'npm run loadMocks', and check:

  • http://localhost:3000/products
  • http://localhost:3000/apiv1/products
  • http://localhost:3000/apiv1/products/near/(meters)/lon/(lon)/lat/(lat)

As you save in your editor, the compiler will rebuild and restart the server.

Other commands

Run the linter manually:

npm run lint

Clean temp folders:

npm run clean

Run the tests:

npm test

Generate docs, the output will be in /doc folder:

npm run doc

Production / Integration

To run the project in a server you'll want to run the built code instead src version.

# deploy the repo to server and run
npm install
npm start

Recommendations

  • When requiring from node_modules you must use require:
// require from /node_modules
let express = require('express');
  • With other module types you can use import (node api, created modules):
import * as fs from 'fs';
import { findConfigFile } from '../lib/utils';
  • To change project name update package.json
"name": "project_name", <-----
...
"dev": "tsc && DEBUG=project_name2:* ... <-----
  • All your reusable functions must return promises for better use with async/await.
let readFile = function(file, encoding) => {
    return new Promise((resolve, reject) => {
        fs.readFile(file, encoding, function(err, data) {
            if (err) {
                return reject(err);
            }
            resolve(data);
        });
    });
};

Roadmap (TODO)

  • API authentication with JWT
  • Add SSL
  • Add cluster
  • User system (register, login, etc)
  • Add sequelize
  • Add test coverage report
  • Yeoman
  • Basic panel

License

MIT

Made with ♡ by Javier Miguel González @javiermiguelg