1.0.0 • Published 1 year ago

@f1stnpm3/nobis-saepe-facere v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@f1stnpm3/nobis-saepe-facere.js for Node.js

Subscribe Downloads Status Dependencies status

Powerful @f1stnpm3/nobis-saepe-facere for Node.js that just works so you can focus on your awesome project:

// Include it and extract some methods for convenience
const @f1stnpm3/nobis-saepe-facere = require('@f1stnpm3/nobis-saepe-facere');
const { get, post } = @f1stnpm3/nobis-saepe-facere.router;

// Launch @f1stnpm3/nobis-saepe-facere with options and a couple of routes
@f1stnpm3/nobis-saepe-facere({ port: 8080 }, [
  get('/', ctx => 'Hello world'),
  post('/', ctx => {
    console.log(ctx.data);
    return 'ok';
  })
]);

Getting started

There's a whole tutorial on getting started for beginners but the quick version is to first install @f1stnpm3/nobis-saepe-facere as a dependency:

npm install @f1stnpm3/nobis-saepe-facere

Server requires Node.js 7.6.0 or newer. Node.js 8.x.y LTS is recommended.

Then you can create a file called index.js with this code:

// Include the @f1stnpm3/nobis-saepe-facere in your file
const @f1stnpm3/nobis-saepe-facere = require('@f1stnpm3/nobis-saepe-facere');
const { get, post } = @f1stnpm3/nobis-saepe-facere.router;

// Handle requests to the url "/" ( http://localhost:3000/ )
@f1stnpm3/nobis-saepe-facere([
  get('/', ctx => 'Hello world!')
]);

Execute this in the terminal to get the @f1stnpm3/nobis-saepe-facere started:

node .

And finally, open your browser on localhost:3000 and you should see 'Hello world!' on your browser.

Documentation

The library is documented here:

Full Documentation

Subscribe here to receive tutorials when released. Tutorials are good for learning while the documentation is good for reference/quick use once you know the basics.

You can also download the repository and try the examples by browsing to them and node . inside each of them in /examples.

Use cases

The package @f1stnpm3/nobis-saepe-facere is great for many situations. Let's see some of them:

Small to medium projects

Everything works out of the box, you get great support for most features and you can easily tap into Express' middleware ecosystem. What's not to love?

Some of the included features: body and file parsers, cookies, sessions, websockets, Redis, gzip, favicon, csrf, SSL, etc. They just work so you will save a headache or two and can focus on your actual project. Get a simple form going:

const @f1stnpm3/nobis-saepe-facere = require('@f1stnpm3/nobis-saepe-facere');
const { get, post } = @f1stnpm3/nobis-saepe-facere.router;
const { render, redirect } = @f1stnpm3/nobis-saepe-facere.reply;

@f1stnpm3/nobis-saepe-facere(
  get('/', () => render('index.pug')),
  post('/', ctx => {
    console.log(ctx.data);
    return redirect('/');
  })
);

API design

From the flexibility and expressivity of the bundle, designing APIs is a breeze:

// books/router.js
const { get, post, put, del } = require('@f1stnpm3/nobis-saepe-facere/router');
const ctrl = require('./controller');

module.exports = [
  get('/book', ctrl.list),
  get('/book/:id', ctrl.item),
  post('/book', ctrl.create),
  put('/book/:id', ctrl.update),
  del('/book/:id', ctrl.delete)
];

Real time

Websockets were never this easy to use! With socket.io on the front-end, you can simply do this in the back-end to handle those events:

// chat/router.js
const { socket } = require('@f1stnpm3/nobis-saepe-facere/router');
const ctrl = require('./controller');

module.exports = [
  socket('connect', ctrl.join),
  socket('message', ctrl.message),
  socket('disconnect', ctrl.leave)
];

Author & support

This package was created by Francisco Presencia but hopefully developed and maintained by many others. See the the list of contributors here.

You can also sponsor the project, get your logo in here and some other perks with tons of ♥

definePropertymatchAllqueueMicrotaskstreamsreact-testing-librarycommanderArray.prototype.containscoreoptiondotenvwatchingswfReactiveXlastmovexhrautoscalingparsingspeedES5takeECMAScript 3promiseschannelmkdirpObject.fromEntriescallObject.getPrototypeOfnodesyntaxerrorerror-handlingFloat64Arrayloadingpnpm9mimetypesduplexvisualxtermRxlinkFloat32ArrayoptimistbrowserlistreadregularlinewrapbyteLengthloggerwordwrapjsxArray.prototype.flattenthroatArray.prototype.findLastIndexauthemrfindLastIndexcss variableregular expressionssymlinksstringifierString.prototype.trimreplaykeysRegExp.prototype.flagsworkspace:*airbnbcloudfrontArrayBufferfastcopycloudwatchjsdiffrateoptimizerrouterapplesscssstyleguideutilitiespackage.jsonarraysESsigintoffsetdeterministicamazonsigtermstateprefixdataless mixinsfullweaksetruntimeECMAScript 2021route53escapehasOwnPropertyglobartformattingstoragegatewayaccessibilityemojivariables in csscjkform-validationaccessorownstableparsebannermulti-packageefficientagentparentTypeBoxAsyncIteratorfindLastcomputed-typesreduce_.extendquotemochaPromisetypanionnameextraInt8ArrayclonejsES2016termtouchasciitoArrayconfigyamlhookformroutinglockfilerobustcall-bindECMAScript 2015isintrinsicimmutablei18nshimajvwarningshamcharacterObject.assignECMAScript 5getOwnPropertyDescriptorfastcloneserializeCSSStyleDeclarationreadableflattenargvoperating-systempackage managernumberECMAScript 7encryptionspecchrometypescriptexit-codefull-widthfromvestwhatwgspinnerlanguageutilityECMAScript 2019coercibleES7[[Prototype]]ES2022.envec2ttyUint32Arraylibphonenumberfindrm -rfArray.prototype.flaturlcharactershandlerstoolkitES8typesafeshellbufferscss-in-jsstdlibreadablestreamObject.keysunicodesafeworkflowdynamodbreduxpicomatchphoneiteratorassignasteventDispatcherchromiummomentgroupObject.definePropertyjQueryboundshebangrgbchaitypesmapreducedependency managervpcsesclassesratelimittypeerrorlookscheme-validationexpressionbreaktslibeveryUint16ArraywafarktypetrimRightArrayES6consolebatchbrowserslistBigUint64ArraytaskSymbol.toStringTag256fseventsendpointl10nfast-copyES2019reducerqueryconfigurablesignalsymlinkgdprstylesheetdeepcopycallbindpostcssthrottlees2016ECMAScript 2022inputgetintrinsicfigletsequencepackagesharedarraybufferterminaltrimStartes8processfile systemmkdirprotocol-buffersdom-testing-librarysortnegative zerowhichJSONWebSocketcolorsprivate datajasmineeslint-plugincreatehigher-orderconcurrencylintmatchesdatecssauthenticationdescriptionreact-hookslazyECMAScript 2018Array.prototype.findLastArrayBuffer.prototype.sliceincludessortedbootstrap csscryptonceroutestylesformparentsupreact-hook-formcolorpreprocessorbundlerinstalltypedes2017indicatoryupObject.entrieses-shimsfunctionshotinenumerablees-abstractawesomesauceArray.prototype.flatMapextensioncorsjapaneseregextrimLeftArray.prototype.includeseslintconfigobjString.prototype.matchAllpluginjsonpathschemejwtmacosCSScompilerwatcheroutputStreamsrapidprettyasserttextexecvaluetelephonewriteObject.valuesdependenciesdeepclonesharedequales2018nodejsrestURLtapediffStyleSheetproprdsStreamgradients cssUnderscorevalidateguidhookslivewaitECMAScript 2017argparsearraybuffertapebssinatrawalkfoldercommand-lineTypeScriptnested cssbeanstalkpasswordwatchtesterjesttestURLSearchParamsreactmimeES3setPrototypeOfgroupBygetopttypedarraytostringtagSymbolcompareES2020sideidleinvariantflagBigInt64ArrayES2021core-jsfixed-widthpropertiesstatelesscallbackmiddlewareassertsimportwebclipatchnpmlrucryptoclassnamereal-timeexitcheckelbsnsMapSetnegativegenericselmmake direxpresspipeqsdatastructuremodulesajaxcensorimportexportregexpredux-toolkitcolumnenderframeworkwatchFilesetImmediateslotiamdirectoryzerodeletecommandWebSocketsserializercontainsfastifyeventstimeremovemapglacierbindopencolumnsArray.prototype.filtermime-dblogformats3ES2017protoHyBikey-0persistentES2023cacheECMAScript 2023inspecteslintplugin$.extendfluxequalityelasticachestatus@@toStringTagsimpledbsqsdefineidpreserve-symlinksvalidationcurlObservablerecursivecloudtrailReflect.getPrototypeOfisConcatSpreadableinternalloadbalancingfind-upES2015monorepoconcatnopewindowstc39ECMAScript 2020gradients css3dataViewfsloggingelectronargumentbcryptlengthinstallerfilterpromisehas-ownrequiretyped arrayirqserializationdomfast-deep-cloneESnextbusyMicrosoftdeep-clonermless.jsesrm -frschemaes5styled-componentsUint8ClampedArrayarraynamesstreams2css nestinghttplook-upcallboundiemrusuperstructrandomcopygetterhastoStringTagcall-boundInt32Arrayrequestcodeserrorcompile lessTypedArraydebugtrimassertionconcatMaphttpsECMAScript 2016code pointssettingsclassnamesavaworkerPushbluebirdutil.inspectmatchenvironmentconnectiterationpropertystarterhelpersponyfillbyteOffsetlistenersargsviewpolyfillbddcolourredactecmascriptes7circularjsdomfullwidthFunction.prototype.nameformses6tddresolvefast-clonelimitrestfulreusedropjoidirstringmakejavascriptes-shim APIprotobufJSON-SchematypeofwrapObservablesflatstringifyReactiveExtensionsdescriptorstylinglimitedWeakSetgetstyleES2018
1.0.0

1 year ago